Take the worst or grimmest and darkest side of society, give them a place where all their sins are given free roam to be expressed, and collect it into a system that can just barely sustain itself and you get the Wretched Hive.
It will be a mostly lawless setting, usually (over) populated by criminals. There may be no actual government in this Wild West or Scavenger World because it is miles or light years away from civilization, and if there is it's probably a Dystopia that's corrupt, incompetent, obstructive or perhaps just uncaring enough to not bother to spread its reach to all corners of society. If this hive has any truly good authorities, expect them to be extremely overworked, incapable of controlling the sky-rocketing crime everywhere, or just too idealistic to survive. An alternative is to have it as a gang-like system ruled by a mob boss, Big Bad or Evil Overlord who allows evil, but only to a certain standard. It could be truly lawless with no authority other than the big stick you carry with you.
The economy is often no better. Public facilities are usually falling apart, and the subways and buses are often full of crooks and junkies. Any schools in this place will almost inevitably be impoverished or sadistic. The roads may be cracked and broken, with a Trashcan Bonfire ever fifty feet or so. Many buildings have been abandoned, to be occupied by vermin, hobos, or criminals. Decent jobs are few and far between. Housing (if you can get it) is unsafe, filthy, and overcrowded. In short, poverty is the norm, not the exception.
This lawless setting is often wonderful for allowing all varieties of creativity, ideas and/or tropes to flow in, be played and interact in interesting ways, and many plot conveniences that the protagonists need to get away with doing active work rather than just handing problems over to the police or running into Fridge Logic when they don't get arrested for taking the law into their own hands, while there are several takes on all sorts of unlawful or devious acts. Gangs, cons, gambling, underground fighting, rampant prostitution, a thriving black market (ranging from one guy with some watches under his coat to a literal market), jaywalking and many more. This can be portrayed as anything from guilty fun, inevitable underbelly of humanity to constant danger. The heroes can always find some misdeed around them to solve and the villains will have little problem finding a safe hideout or Bad Guy Bar to get together and plot schemes. Compare Tortuga and Gotham to take two recent film examples.
The Wretched Hive has a few Sub Tropes in increasing size:
Den of Iniquity A room in the Big Bad's lair where the mooks get to indulge in various forms of debauchery.
Bad Guy Bar A tavern of ill repute where the crooks get together to scheme or get a drink. The tenuous peace is only held together by The Bartender and his Bouncers.
The City Narrows The back alley to the entire town; a small section of a city that has a bad name for a good reason and gets avoided by decent folk with any sense.
Red Light District A street, block, or even complete district of a city devoted to prostitution and other illicit trades.
Outlaw Town A settlement run by criminals, for the benefit of criminals.
Not So Safe Harbor A port, harbour or coastal town that has fallen into wretchedness due to the flux of sailors and pirates and the sort of rough entertainment they desire.
Vice City An entire urban sprawl that has fallen to wretchedness including its authorities which provide little sense of escape but also little constraint. Often overlaps with City Noir.
Soiled City On A Hill A city so far gone it is beyond saving. Wipe it off the map and start again.
The fictional Thai city of Roanapur from Black Lagoon is regarded as the criminal capital of the world.
The Zaraki region of Soul Society in Bleach. When the Blood Knight comes from there and treats slicing up people and smelling like blood as everyday activities, that's because there's a really bad place. Makes one wonder how Hell would be...
Mock Town from One Piece. Since the World Government only controls one Island there, the second half of the Grand Line, dubbed the "New World" controlled by the Four Pirate Emperors, it's safe to say it is.
Subverted in Princess Mononoke. When seen for the first time, the Ironworks are a bunch of grey roofs and tall smoking chimneys crowded together on a small hill surrounded by heavily barbed barricades inside the rotting stumps of a razed forest. But once Ashitaka gets inside, the steel workers are astonishingly well mannered and cheerful people who hold their equally charming director in very high regard.
Lux in Texhnolyzeis this trope. The parts of the city that aren't in the control of three vicious gangs struggling with each other are in hopeless squalor, and the "normal" populace can easily be more dangerous than the gangsters in those parts.
Comic Books
Snowtown in Fell is described as a "feral city" where nearly all infrastructure has fallen apart.
Calia, the so-called "Republic of Desperados" that was founded by escapees from Devil's Island, appears in the Modesty Blaise serial "The Jericho Caper".
Cynosure from Grimjack Where all the dimensions meet. In many dimensions you need to hire a Bodyguard/Private Cop or a whole Private Army. Or just be Total Bad Ass.
Downlode in Sinister Dexter is one that covers most of Central Europe.
Legion of Super-Heroes gives us Rimbor, the homeworld of Legionnaire Ultra Boy. Yes, the planet is a Wretched Hive.
Gotham City. Comic writer and editor Dennis O'Neil has described Gotham as "Manhattan below Fourteenth Street on the coldest night in November" — only year-round, and on the scale of a city. (For context, recall what a Crapsack World New York was in the early 1990s, when O'Neil wrote that.)
In the New 52 continuity, Gotham's miserable state is partly due to the influence of the Court of Owls, a secret society that relies on Gotham being a Wretched Hive to maintain their power. They are devoting all of their resources and risking their own secrecy to getting rid of Bruce and his associates because Bruce's work as Batmanand as Bruce Wayne might actually make Gotham a better place.
Even worse was Bludhaven, the focus of Nightwing, a city 30 miles out of Gotham that seemed to pick up all the filth that Gotham was too saturated to hold. Eventually it got nuked during Infinite Crisis.
The Question: Hub City, which can legitimately claim to be worse than Gotham and Bludhaven put together.
Aztek: Vanity City. It's explicitly stated to be worse than Gotham. It is hinted that most of its buildings have Alien Geometries that increase violent tendencies in their inhabitants. The town turned its resident superhero from Captain Patriotic to a Nineties Anti-Hero.
In The Life And Times Of Scrooge Mc Duck the town Dawson evolves into one during the height of the gold fever. The local mounties keep far away from the town, citing that: "There's only twenty of us!"
Don Rosa makes a disclaimer in his foreword that the real Dawson City was in fact remarkably peaceful and law-abiding place for a town founded in the Gold Rush thanks to the efforts of the Mounted Police, and that apart from the name the town in the stories is based on its counterpart on the United States' side of the border, Scagway, which in contrast lacked any kind of law enforcement.
Issue 194 "Cabel and the She Warrior". The planet Netherworld is populated by thieves, murders, sadists, terrorists, arsonists and the infamous Vytronian Slavers.
Issue 208 "Planet of the Dead". The planet Vegas Prime' entire surface was covered in all manner of vice dens and it is home to various criminals both petty and serious. Law enforcement is thin on the ground and murder is commonplace.
Doctor Who Magazine: In "The Cornucopia Caper", the Doctor visits Cornucopia, an entire planet ruled by an alliance of different criminal guilds.
Fan Fiction
The Dark World segments of Dungeon Keeper Ami have a certain vibe that reads like this. Actually played with to some extent- the waylaying, slavery, debauchery, and general amorality aluded to is pretty typical and even expected of the underworlders. Further enforced by the various cults of the Dark Gods. Some of the cities are actually fairly clean, leading to Vice City feel.
The Ponies Of Olympus series uses this exact phrase to describe the Storm Alley neighborhood of Cloudsdale.
Films — Live-Action
Mos Eisley from Star Wars, the trope namer. The new trilogy has the lower levels of Coruscant like this. And the Expanded Universe has Nar Shaddaa, a moon of it.
On a broader scope, the planet Tatooine. It's ruled by the Hutts, a race of gangsters. Every single city—not just Mos Eisley—is shown to be incredibly hostile and filled with criminals. As far as natives go, take your pick. You've got the thieving Jawas or the Always Chaotic Evil Tusken Raiders. Or The Empire.
Escape From New York can qualify as well. Technically, in this film the island of Manhattan is a prison if you observe it from the outside, but if observed from the inside, it's a Wretched Hive.
The film was shot in downtown and east St. Louis, the former of which was a real life wretched hive at the time (the area has since been cleaned up and restored) and the latter still is.
Casablanca. As a way-station for people from all over Europe who hope to escape the Nazis, it has acquired a strong criminal element, whose police force is headed by a self-described "poor corrupt official". Ferrari, the head of all illegal activities in Casablanca, is "a respected man". A pickpocket swipes a man's wallet while warning his mark to look out; "There are vultures, vultures everywhere!"
Rick mentions it would be a bad idea to try conquering New York for this reason. The Germans simply wouldn't stand a chance against the local population.
Spoofed as Sogo the City of Sin in Barbarella. Since it was made in the 1960s for general release, the evil shown on the screen mostly consists of people in weird costumes looking darkly at the protagonists, plus some very mild bondage games.
The New York City of the real world is portrayed this way in Last Action Hero. Two people are shot dead in the middle of a public street, with bystanders visible in the background, and one of the shooters takes the time to shout to the rooftops that he did it and wants to confess. The only reaction is someone yelling at him to shut up.
The setting of Indonesian action flick The Raid is this. It's a rundown apartment controlled by drug lord and populated by drug soldiers.
The titular ghetto in City of God — a place controlled by drug gangs where little children murder each other in the streets.
District 9 in the film of the same name is this all over - an alien ghetto of makeshift shacks whose inhabitants are listless, unemployed and often criminal, nominally run by a corrupt multinational but infested with gangsters, and the only authority is backed up by sadistic mercenaries. To get that authentic feel, the movie was filmed in a real life Johannesburg slum.
Gamebooks
Titan, the official setting for the Fighting Fantasy gamebook series, has a couple of these. The most notorious are Port Blacksand, well-known as the City of Thieves, and Khare, called the Cityport of Traps. One is a ramshackle collection of pirates, thieves and murderers who'd slit their mothers' throats for a few copper pieces (if mommy didn't get them first), and the other is a debauched collection of cultists and slavers of every conceivable race, who only manage to live together without killing each other because their city is the only thing resembling civilization in a wild, hellish wasteland.
Ragadorn, main city of the Wildlands in the Lone Wolf series. Vakovar in Magador even more so.
Deadwood: Deadwood itself. Eventually gets a telegraph, employs a sheriff and elects a mayor. Remains a place where the preferred way of getting rid of inconvenient corpses is by feeding them to Mr. Wu's pigs.
Justified: Harlan. Particularly in Season 2 when Doyle Bennett uses his police job to keep his family's crimes covered up and intimidate any opponents.
Revolution: All cities are apparently like this now: "If you were smart, you left the city. If you weren't, you died there."
Trailer Park Boys: Sunnyvale trailer park Nova Scotia, a mockumentary about three career criminal conmen, and their kin. This property is supervised by a drunk deranged discharged cop and his dimwitted obese underling. Overrun with feral children who randomly throw bottles at residences, and 3 career criminals who naturally cause hilarious hell during the course of the season which revolves around that seasons "Big Dirty" (career heist).
The Wire: Averted Trope. While the lion's share of the show takes place in neighborhoods where everyone is either a drug dealer or a drug addict, the show takes time out to illustrate there are nice parts of Baltimore. Further, it takes a close and careful look at how such disparate places can be so close together and yet so far apart. Quoth Bubbles, "Thin line 'tween heaven and here."
The Free Zones or "Hamsterdam" on the third season is what happens when you concentrate all West Baltimore crime in one place.
Music
In the Alestorm song "Nancy the Tavern Wench", the titular Nancy's tavern is such a hive.
The song "Night City", by The Sword, is about such a place — a metropolis on the dark side of a tidally-locked planet, ruled by slavers and pirates.
The street in the Space song 'Neighbourhood' is definitely one. It's got an Omnicidal Maniac, an Ax Crazy vicar and a family of criminals, amongst others.
Mötley Crüe's song "Wild Side" takes place in a Wretched Hive.
Guns N' Roses' song "Welcome to the Jungle" also depicts a Wretched Hive. In fact, the line "You know where you are? You're in the jungle, baby! You're gonna die!" was said by a cab driver to Axl Rose during a trip to visit a friend.
Religion
Hell, when it's not all fire and brimstone, is this in some interpretations, like "eternal separation from God". Believers consider this to be terrifying enough.
Sodom, Gomorrah, and Ninevah as portrayed in The Bible. Sodom and Gomorrah were considered so vile that nothing short of divine obliteration was enough to clean them. This trope was actually subverted in the case of Ninevah. God told Jonah to preach the people there to repent, or else the city would be destroyed in three days. The king of Ninevah saw the error of his ways and told his people to mourn in sackcloth and ashes in hopes that they would be spared. God did not destroy the city, much to Jonah's chagrin. The last part of the book of Jonah is God giving Jonah a big "The Reason You Suck" Speech because he would rather see thousands of people die than come to repentance.
Sodom's population has been estimated by some to be between 600 and 1200 at the time of its destruction. And in all the city, not ten righteous men could be found, thus God destroyed it.
In The Bible, after King Solomon's reign, Israel divides itself North and South, and lots of corruption and idolatry take place. And then it goes From Bad to Worse as they got involved in wars with neighboring nations such as the Assyrians.
The fallen space port of Svoboda in Nexus Gate fits the bill. It is controlled by crime syndicates and the playground of criminals of every stripe. Kovolis holds no stake in the port's ground.
Erossus in Dominic Deegan. So kinky that you can buy little candies shaped like certain body parts and the police wear Stripperific outfits.
New Hong Kong, in Buck Godot Zap Gun For Hire. It has one Law Drone, but since New Hong Kong has no laws, it spends a lot of time meditating up on a tower. New Hong Kong may have only one law ("There shall be no laws on New Hong Kong") but it has a great many customs, and the populace enforce them so effectively that it's actually quite peaceful. In the same sense that Ankh-Mopork is peaceful under the Thieves' Guild. Or as the residents of New Hong Kong put it: "There are no laws here. That doesn't mean that there aren't rules."
The Ciem series features the cities of Craterville, Dirbine, and Viron. Contained therein are: Monsters, Mutants, alien gangsters, pedophile gangsters, serial rapists, international spies, thugs that break down motel room doors at random, arsonists, ex-government agents-turned-pedophile kidnappers, suicide bombers, debit card thieves, mass-murdering AI, and more. Guns (and darts!) are everywhere. Churches have almost no 20-something members, because of a belief by the older members that nobody who attends Viron University has any self-control. Upon a visit, Miriam wishes to ask Candi: "How does anyonetolerate living here?"
Survival of the Fittest has this with Denton, New Jersey. Criminal gangs are everywhere in the city, which is practically run by the most powerful of them instead of by the Mayor himself, as the whole police force is either too corrupt or too inept to do anything. Like any other gangs, they've divided the city up between themselves, and they maintain a tense peace between them, as the bloodshed brought by a gang war is bad for business. Even then, though, shootouts and gang brawls are common, while anyone who sticks their nose in the wrong place turns up dead. This is considered highly unusual in SOTF's world, though, and no other city that has been seen is quite as bad as Denton. This came about as an attempt to justify all the gang members in Pregame, and the city apparently disintegrated into full-scale warfare after v2.
After the events of Extermination in Worm, parts of Brockton Bay have become this. Imagine New Orleans right after Katrina, with super powered criminals and psychos who regularly steal supplies and worse. Then it went From Bad to Worse and the government considers condemning the entire area.
Haven Hive from Schlock Mercenary. Let's make a list: lack of any semblance of law with criminal gangs everywhere, check. A monopoly on medical treatment with legitimate doctors being forced to leave or killed, check. No OSH Acompliance with multiple highly flammable objects out in the open on a space station, check. People being kidnapped to be used to grow medical nannies for the medical monopoly, check.
Avatar The Last Airbender holds a couple of these; the ice spring in the middle of the desert, the bar that Jun the bounty hunter is at, and the lovable port with the pirates. "Who's brave enough to look into this bag?"
The Simpsons—The family visits New York City. According to Homer's flashbacks to his last visit NYC conforms to the trope. Every living thing is corrupt in some way. On his last visit, a random guy steals his coat, a cop steals his wallet, and a pigeon steals the very hotdog he was eating. Right from his mouth. A New York pigeon. Also the teller he was reading claimed that "crime was up eight million percent".
Galaxy Rangers had Tortuna. Nominally controlled by Her Travesty, though the Mooks are receptive to bribes. It's crawling with criminals of every stripe, and any human setting foot there at risk of being handed over to the local torturers to be mashed down for Life Energy. Yup, the heroes end up having to head there almost every other episode.