One Piece has Brook, who after a series of particularly unfortunate circumstances ends up spending nearly fifty years without sunlight or contact with any other living thing. Because of a promise he'd made he couldn't even kill himself. The brief flashback set ten years into his ordeal leaves little doubt that he's gone off the deep end, to say nothing of when the main cast finds him after another forty years.
The lack of a natural death is (mercifully) debatable fanon, however. In his introductory arc he referred more than once to the fact that his second lifetime is expected to simply run out eventually.
This trope is emphasized by the fact that Brook's remaining crew dies while playing a song. As they die, he comments that it's only a quartet, trio, duet and finally solo, resulting in the (former)page picture.
To add some more perspective on this, one chapter was dedicated to reviewing the timeline of the universe. When the rest of the Straw Hats were just starting to go through their tragic pasts, Brook was still by himself, amusing himself by leaning up against walls at various angles.
In obscure doujinshi series Mythic Quest, every human in the world is transported to a different dimension at the beginning of the Sorcerer's Curse arc. Except one, the female lead. For five years.
Pandora Hearts has Alice, the B-Rabbit, spend a lot of time alone in the Abyss.
Black Mage Zeref of Fairy Tail spent centuries in self-imposed exile after he realized the value of human life one day and lost control of his death magic because of it.
Takahiro Aramaki of Seven Seeds is the only survivor of Team Winter... who turn out to have awakened from cryostasis about fifteen years before the other teams. He spends the intervening time alone except for his dogs; while he doesn't go crazy, he's very rusty at dealing with people by the time he meets the other survivors.
Hulk: The End: "Hulk is the strongest one there is!! Hulk is the ONLY one there is!! Hulk is the only one there is!! Hulk feels...cold."
The short-lived The Last American, from Marvel's Epic Comics line, was about this.
In a What-if tale in the Marvel Universe, Cain Marko, the Juggernaut, has powers that make him invulnerable and immortal. He wanders the Earth because a strange plague had wiped out both humankind and mutants. He discovers a stronghold of surviving mutants. Magneto tries to stop him. He cannot. When he get to them, the survivors inform him that he has the plague but cannot die because his power made him immune. Cain is immortal, but he has doomed all that remained of mutantkind. They ask for him to leave before they die. Cain, who always was a dick, agrees with them. He roams the really solitary Earth, thinking about the truth about his battlecry: Nobody can stop the unstoppable Juggernaut.
God in Preacher was this, being the first and only being before Creation. Many of the terrible things in the story happen because of his pathetic need for love and attention.
Moon (2009). Sam Bell is nearing the end of a shift maintaining Helium-3 mining operations on the far side of the moon. Unfortunately, his only company is a computer (GERTY) and his contact with the outside world is restricted to occasional transmissions bounced off other planetary bodies. He spends his days comforting himself with the fact that he'll soon be reunited with his wife and baby daughter... but after three years effectively on his own, he's starting to crack...
The protagonists of the indie flick Nothing. Hordes of angry people are settling on their house, they are hiding in a room, crying and hugging... and suddenly everything apart from them and the house disappears, replaced by a big, white, surprisingly bouncy nothing.
Zac, the protagonist of The Quiet Earth, and the last man on Earth. Or so he believes - although meeting two other survivors is only a comfort for a short while when they start favoring each other's company and leaving him feeling even more alone.
Drizzt in The Dark Elf Trilogy runs away from the drow and lives alone in the cavern labyrinth for ten years and he's nearly losing his mind despite having the magical panther. In the end he approaches the svirfnebli who have been fighting the drow for millennia in the hope of them taking him in.
Ayla for a good part of The Valley of Horses from the Earth's Children book series. She gets thrown out of her tribe and has to survive on her own for three years by hunting, gathering and working alone. She notes that if she ever should get incapacitated for a longer while, she would be doomed. She doesn't go mad but she sure feels very lonely and adopts a horse and a lion.
Island Of The Blue Dolphins. A Native American girl gets trapped, alone, on the island her people used to inhabit, but then left due to the unscrupulous Aleuts (led by a Russian) that came to visit them and ended up killing off many of their men. Even after she gets off the island, it's revealed that the very American boat that took the natives to the mainland got smashed in a storm and nobody survived, so even afterwards she's "alone".
Mau goes through this in Nation after the Wave wipes out his people. It doesn't last terribly long, though, before other survivors start showing up.
In The Island Keeper, a girl who fled to an island to grieve in solitude loses her canoe in a storm, and has to survive there alone until the lake freezes enough to walk out. While she isn't left isolated as long as other examples, bonus points are awarded because she winds up killing and eating a raccoon and a deer she'd originally thought of as her furry friends.
The short story Descendant by Iain M. Banks, from The Culture novella The State of the Art. An injured, shipwrecked soldier must hike a thousand kilometers to reach an outpost with only his damaged spacesuit's AI for company.
Snowman in Oryx & Crake by Margaret Atwell. He is the sole survivor after a virus wipes out the human race and his sanity is definitely debatable.
Something Green by Fredric Brown has a protagonist trapped on an alien world where there is apparently nothing that is colored green. He keeps himself sane by a combination of talking to his alien pet and occasionally firing his Ray Gun, which has a green energy discharge, while he dreams of returning to Earth, apparently the only planet where green things grow. Then he's rescued. It turns out the alien pet is a hallucination. When his rescuer reveals to him that Earth has been destroyed in a war and that he'd have to settle on one of the other, non-green planets, the protagonist has a BSOD and murders his rescuer, then wanders off and completely forgets about the incident and continues to dream of rescue. It's implied that this has happened to him more than once.
I Am Legend has this pretty bad. Robert Neville commits suicide while awaiting execution, after realizing that a single man in a world full of vampires is the true monster.
Allen Steele's Coyote, in which a group of political dissidents escape on an interstellar spaceship, has exactly one passenger pulled out of hibernation en route. He can't go back in. The destination is centuries away. He goes mad for a while, then spends the rest of his life painting murals all over the ship.
Thomas Glavinic's novel Night Work, in which Jonas, a resident of Vienna, wakes up one day to find himself the only person in existence on the whole planet. Even animals and insects are gone. With no one to interact with, he turns on himself.
Men opens with one of the characters engineering the apocalypse, killing everyone else on the planet except him. Naturally, he goes insane. Then becomes sane again. Then goes insane again. Then becomes sane again. Over and over, for fifty thousand years. Then he finds that he wasn't the only one left. There were still babies kept in capsules.
The Shadow King in The City of Dreaming Books would be killed if exposed to sunlight, and does not dare interact with normal people for other reasons. He occasionally watches or listens to them, but spends most of his time in caves deep under the city. He is not the most sane of individuals.
Pi Patel of "Life of Pi" becomes stranded on a lifeboat for 277 days with only a Bengal tiger to keep him company. The only other human being he encounters on the ocean is a similarly insane, cannibalistic Frenchman.
Trapped on Draconica: Invoked. Rana traveled to perhaps the most inhospitable place in Draconica to be alone. Ironically, this is also the only place in the world where one can hear what's going on everywhere in the world.
Live Action TV
Subverted by Galen Tyrol on Battlestar Galactica. Driven half-mad by Humans and Cylons alike, he settles in a dreary, desolate part of the world (implied to be Scotland) so he never has to see another living being ever again.
Earlier in the season, D'Anna does the same thing, deciding to stay on the ruined Earth of the Final Five.
Omega, from the third Doctor's run of Doctor Who, is trapped alone in an antimatter dimension for millennia. He's shown to be pitifully insane by the end of the story.
Another example (especially with the new series) is the Doctor himself, now the last of his species (excluding the Master's occasional explosive cameos). On top of that, his companions keep abandoning him; he generally picks up another one soon afterwards to avoid being alone again. At the end of the Tenth Doctor's life we are shown what happens if he doesn't do that... it's not good.
Sylar experiences this in the final season of Heroes as he gets sealed inside an empty shell of a city inside his own mind by Matt Parkman. In there, he experiences three years of being alone with nothing but his various psychological issues and guilt to deal with. Add in the sudden appearance of his archnemesis Peter to further exacerbate his guilt, it's no wonder that Sylar has completely cracked to the side of good by the end of the series.
Rousseau, Lost. She's been on the island alone for 16 years (until season 4) and is mad as a hatter. There's some chicken-egg debate here, seeing as she's alone because she killed the rest of her team.
Claire has followed in her footsteps, spending about three years alone on the island.
Stargate SG-1 uses this trope in the episode "The Torment of Tantalus," in which Ernest Littlefield has been trapped alone on an alien planet for about 50 years and has gone crazy. He recovers surprisingly quickly.
Lemon Demon's song Saga of You, Confused Destroyer of Planets has a character who, after unintentionally destroying the world, becomes the Aloner for awhile. Though he deals with it better than most:
You moved on, you got old. You got used to the dark and the cold. You withered away into a pile of dust. Completely withered away into a pile of dust.
The song Iter Impius by Pain of Salvation shows us what happens to a man who had cryogenically frozen himself in a process to grant himself immortality. In the intervening time, mankind destroyed itself. After contemplating suicide, he declares himself king of the world and presumably remains there alone for eternity.
I'm never crossing that line Leaving this world behind I will stay on my own On this blood-stained throne.
Porcupine Tree's song A Smart Kid is about a young man who finds himself on an Earth completely devoid of all other humans after some man-made disaster. Some aliens show up and he plaintively asks them to "please take me with you." Youtube Link
"Sole Survivor" from Blue Öyster Cult's "Fire of Unknown Origin" is the story of the last man on Earth, "cursed with second sight," who wants to know why he, out of all others, survived. Eventually, extraterrestrials arrive and beckon him to join them, but he chooses to run and hide, remaining the sole human alive on Earth.
Eugene:(to Connie) It was the most horrifying thing I've ever experienced. I've never felt such loneliness or isolation. It was as though I'd become completely separated from... everyone and everything... completely and thoroughly alone. Nonexistent, in a dark void of solitude. I was alone, Connie! Utterly alone, in a burning blackness, and I've had nothing but nightmares since then!
In the Scion roleplaying system, the ultimate power of the 'Justice' domain allows the user to "condemn" someone - assuming he knows for sure that they committed a great crime. Doing so traps them within their own mind, in a prison-cell, completely isolated from anything and everything, for months and years - to their perception. When their "sentence" finally ends, they wake up, with merely a second having passed in the real world. It is implied that most mortals do not get through this with their sanity intact - it is, after all, designed to put the fear of God(s) in magical beings and titanspawn...
The eponymous protagonist of Dr. Muto.
The "Rat Man" from Portal. Hiding from GLaDOS in nooks and crannies of the Enrichment Centre, he cracked up and scrawled messages, poems and declarations of love for the Companion Cube on the walls.
You are this in Minecraft. It's just you and a world eight times the size of the planet Earth.
Also creepers, zombies, and skeletons. Lots of them.
This only applies to single player.
Samus Aran is usually completely alone on whatever planet her mission is on in most of the Metroid games.
*Hyun-ae and *Mute, the two AIs of the Mugunghwa in Analogue A Hate Story, were like this during the 600 years before you showed up. And then presumably go back to this if you don't take one or both of them with you when you download the ship's logs.
Halo's 343 Guilty Spark was left to oversee Installation 04 all by himself for 100,000 years, with nothing but increasingly infrequent communications from the Monitors on the other six Halo rings for company. After exhausting all his planned experiments and entering longer and longer periods of hibernation, he started ejecting portions of the ring's landscape into space to keep occupied. In the Anniversary terminals, he notes that the Forerunners really ought to have assigned two monitors per ring.
In Sponge Bob Square Pants, Squidward enters a Time Machine and ends up in a formless limbo. "Finally, a place where I can finally be alone." He lasts all of one minute before screaming to get back home.
In an episode of Justice League, immortal villain Vandal Savage accidentally caused the death of the human race and spent thousands of years alone. Thanks to a time-lost Superman, he's able to prevent these events from happening, and though it caused him to cease to exist, he was ''happy.''
Though considering his immortal nature, one can assume that he vanished because there is another, in-continuity version of him walking around in the now changed time-line. It is mentioned in the episode that no two versions of one person can exist at the same time.
Strangely enough, came up a couple of times in the 2003 Strawberry Shortcake series. In "The Mystery of Seaberry Shore," Coco Calypso is the sole inhabitant of the eponymous shore (save her pet parrot and two dozen monkeys). When Strawberry is called in to investigate a seaberry robbery, it becomes apparent that Coco, contrary to her song ("With all that I've got, with all that I've found, it's okay by me if there's no one around."), is incredibly lonely. Fortunately for her, the thief was just a girl who lives in a neighboring lagoon who used the seaberries for sustenance before Coco started harvesting them. With the misunderstanding cleared up, the two girls resolve to be friends and share the berries.
In "Strawberry's Big Journey," Strawberry's car breaks down just outside of a small town whose only resident, Banana Candy, takes on all the jobs in the town (claiming she needs them to make ends meet). In order to keep Strawberry and her friends from leaving, she plans to sabotage the car even more, but hearing about their trip, she has a change of heart, fixes the car and confesses to everything. Hearing that she's never left the town before, Strawberry invites her along on their trip, and she seems to have taken up residence in Strawberryland since then.
Demona from Gargoyles fits this trope well; decades of watching her species being driven almost to extinction (often through her own fault, not that she'd admit it), centuries of being hunted down by men in striped masks, and finally alienating the few gargoyles who survived to the 20th century have driven her completely insane.
Demona: The access code is "Alone."
The Family Guy episode "Road To The Multiverse" featured a universe inhabited by only one guy. He did nothing but shout compliments.
Teruo Nakamura, an Imperial Japanese soldier, did not surrender until 1974. He lived by himself on a small island for twenty years.
Lt. Hiroo Onoda held out for 30 years, and only surrendered upon the direct order of his former commanding officer (who luckily survived the war as well). Onoda was not alone the entire time; two of his men surrendered in The Fifties.
People with Insomnia can feel a lot like this if they don't live with people who also have it. Since most are asleep when they're doing their thing, it can seem that the whole world's died in its sleep.
Island of the Blue Dolphins, in Literature, is based on a true story. The tribe lived on an island off the coast of California, and the American Government resettled them. One young woman missed the boat, and no one came back for 18 years. Disease had killed off the few remnants of her tribe, and she ended her days unable to communicate with anyone around her, even after she left the island, because they had no language in common.