Batman is a competent fighter. The World's Greatest Detective, even. He's agile, resourceful, and is commonly given credit for his ability to prep. He's an average human that has pushed himself beyond average human potential. He's a fan favorite because of his humanity and ability to take down those smarter, stronger, and faster than himself.
Unfortunately, he's not always the victor. Sometimes he takes the punches as well as he gives them. A short list of villains has managed to best the Dark Knight. It's an exclusive club, but it's not always a club one would want to be in because one of the many titles Batman has is "vengeance."
Ten supervillains that defeated Batman
Jean-Paul Valley was the first person to take over Batman's mantle long-term. After Bane broke Bruce's back, Azrael took over and kept Gotham safe while Bruce recovered. When Bruce was ready to return, Azrael had other plans, and things didn't work out the way Bruce expected.
When he returned to the Batcave to relieve Jean-Paul as Gotham's protector, Jean-Paul was reluctant. More than that, he put up a fight and sent Bruce out of his hideout. It wouldn't be until a second confrontation and a battle of wits that Bruce would reclaim his cape and cowl.
Prometheus is a mirror copy of Bruce Wayne. Which is to say, he's the exact opposite. Where Bruce lost his parents to a criminal, Prometheus lost his to the Gotham police. Prometheus similarly has Bruce's brains, wealth, and training.
This anti-bat once broke into the Justice League's Watchtower and defeated everyone inside. This included Batman. A helmet he's wearing that grants him the near god-like powers gives him the ability to do this.
Lady Shiva is a highly trained assassin and arguably the best martial artist in the DC universe. She often assists with training for many of DC's superheroes across the globe. Batman, in particular. Bruce goes to her for help when he's trying to get his skills back after being broken by Bane.
Shiva does not go easy on Bruce. Despite bringing up past fights where Bruce had won, Sandra Wu-San informs him that she let him win. That has to be an eye-opener because the majority of the people that have defeated Batman have been enhanced somehow. Lady Shiva is not a metahuman, though. She doesn't receive any gifts from a god or tech. She's all skill.
Final Crisis was a significant cross-over event that traversed space and time. Darkseid completely dominated Earth using the Anti-Life Equation and enslaved most of the human race. Many heroes were busy fighting their own battles. For example, Flash was investigating a bullet fired backward in time. Batman was handling his issues with Doctor Hurt and the Black Glove.
When Bruce finally freed himself from his psychological break, he found time to save the world. And the universe. Bruce confronts Darkseid, revealing everything he knows about the New God's plan, and then takes out a makeshift gun and shoots the god. Not before Darkseid releases a pair of Omega Rays from his eyes that impact Batman and kill him. Allegedly.
Joker isn't a physical person. Sure, he'll shoot you and leave you for dead, but he's not a hand-to-hand fighter like Batman. So when he beats Bruce, he does it spiritually. In The Joker War storyline, he does just this.
Joker steals Bruce's wealth, takes away the gadgets that give him an edge, and turns the citizens of Gotham City against Batman. Having the very people he protected against him, Bruce's will was shattered.
The Court of Owls
When the Caped Crusader first went up against The Court of Owls, he didn't know what to expect. They were a cabal of Gotham elites that operated in the shadows. They manipulated events throughout Gotham's history to favor them. They often released their highly trained assassin known as Talon to accomplish their goals. This assassin gave the Dark Knight a run for his money.
Bruce found himself at the mercy of Talon and the Court of Owls inside their underground labyrinth. Here, Batman underwent days worth of torture. Psychological and physical suffering. By the end, Bruce was hallucinating and suddenly stabbed by Talon. He managed to escape, but the damage was done.
Bruce typically has the power of "prep-time". This means that he can win any battle given enough time to prepare for a fight. He's not granted this privilege in Predator vs. Batman. The Predator, who pays a visit to Gotham, manages to grab a few trophies for himself (mobsters and boxers) before running across the World's Greatest Detective.
The Dark Knight isn't remotely prepared for the culprit of the case he had been investigating. He is beaten pretty severely when he runs into the hunter from out of this world. So badly that when he narrowly escapes with his life, he has to recuperate in a body cast.
If you were beaten to death with a crowbar by your dad's mortal enemy, you might also have some angst towards your father. No, Bruce isn't Jason's dad, but you get the point. Jason Todd was the second Robin and was murdered at the hands of the Joker. It took years for Jason Todd to find his way back to the land of the living, but he eventually did.
He exacted revenge on everyone he felt was responsible for his death when he did. Especially the big man himself. Batman. Unlike Bruce, Jason has no problem using guns to fight crime like Red Hood. Coupled with his anger, it's no wonder Jason was able to defeat his surrogate father.
Bruce Wayne and Clark Kent are friends. Probably the best of friends that an untrusting ninja who dresses as a bat can have. They've fought on several occasions, though, in different mediums. They duked it out in Frank Miller's The Dark Knight Returns. In the story, the two have a strained friendship that culminates in a battle where Bruce fakes his death.
In the Hush storyline (by Jeph Loeb), there was also the time when Poison Ivy controlled Superman's mind and forced him to fight the Dark Knight. Luckily, Clark is holding back despite being mind-controlled, and Bruce has a few gadgets that help fight against the Kryptonian. Most notable is a kryptonite ring stashed in his utility belt. This ring is enough to give Bruce an edge and survive the battle.
It can never be forgotten that the first time Bruce was truly defeated physically was at the hands of Bane. Bane is a master tactician, and he didn't only defeat Bruce's body, he defeated him mentally and emotionally. This event led Bruce to leave crime-fighting behind for a while.
Bane released all the inmates from Arkham, forcing the Dark Knight to round up and capture them again. This took Bruce some time to accomplish, so he was exhausted by the time he was done and returned home. That was when Bane struck. Ambushing Bruce in Wayne Manor, the two ended up in the Batcave, where Bruce's back was famously broken.