In Code Geass, Suzaku's grave is visited only by the cat Arthur. As some blogger put it, "if the cat is the only person at your grave, you must have really sucked in life." Of course, that scene happened long after the actual funeral and he is Not Quite Dead but still. It signifies how, in the end, everyone saw him as a traitor. To everyone.
Sherry's funeral in Gungrave was attended only by Harry mostly because all of their friends and family are dead.
In the Galaxy Angel anime Ranpha had Forte fake her death as part of a scam she made by pretending to be dead in a coffin. When they got out of the coffin, they found only Vanilla and Nomad doing her funeral, most of their friends attended another man's funeral who was a high ranking officer, while they were buried in some asteroid as its the only thing they could afford.
In one of the first issues of the modern JSA series, at Wesley Dodds' funeral, Wildcat remarks that when Madam Fatal died, the only people who came were the cast of the local production of La Cage aux Folles (Madam Fatal was a male actor who fought crime in old-lady drag, and had been all but forgotten). This may have been sparked by the fact that the only people present were JSA, though the topic at the time was mortality in general, and Wildcat was also wondering how, or if, he himself would be remembered.
Watchmen: Only a handful of mourners turn up to The Comedian's funeral. As Ozymandias observes earlier in the story, "The Comedian made a lot of enemies, even amongst his friends." Aside from the small number of fellow vigilantes who attend the funeral, the only other mourner is one of The Comedian's arch enemies.
Rorschach: Is that what happens to us? No time for friends, only our enemies leave roses? Violent lives ending violently.
During the events of the miniseries 52, Booster Gold appeared to have been killed; no one came to his funeral (even the heroes who carried his coffin were a bunch of Super Zeroes who were paid to do it.) Turns out he had faked his own death as part of a plan against a villain; whether the funeral was part of that or really represented the regard people had for him is unclear. However, in Booster Gold's case this trope has special meaning: He needs his time-traveling life to be a Stable Time Loop, which means he can't be remembered after death, because he knows he wasn't famous in the future. If he had a lonely funeral, it's because he spent his whole life ensuring it'd be that way.
Films — Animation
At the very beginning of Up, the now widowed Carl Friedricksen is the only mourner seen attending his late wife Ellie's funeral. The funeral is never shown — we see Carl alone with the casket (hopefully just after everyone else is gone), but that may be intended to underscore how alone he is without Ellie.
Films — Live-Action
In Charade, there is a funeral scene that is minimally attended, mostly by people making sure the corpse is actually dead.
Parodied in I'm Gonna Git You Sucka. A crowd of people show up for Junebug's funeral. When they realize they're at the wrong funeral, they all leave, taking all of the funeral decorations as they go. The only people left are Junebug's immediate family.
Predicted in Golden Eye. Being a James Bond film, of course it didn't happen but the prediction still holds true. When Bond finally does die, Moneypenny will probably be the closest thing to a friend in attendance. Although after the reboot, Felix Leiter could come as well. But that still makes two.
Subverted in a Crowning Moment of Heartwarming and Tear Jerker in Milk. Harvey Milk's close friends wonder why so few people are attending the funeral service until they step outside and see the street packed with mourners holding a candlelit vigil.
In The Bad and the Beautiful, Jonathan Shields' father had plenty of mourners at his funeral, but only because he willed the last of his money to pay for them to attend.
A Carol Christmas had Carol's aunt Marla who had only her niece and her work partner there. Later on, Carol saw her funeral with only her assistant and her friend there.
It's also mentioned early on that Scrooge was the only person to show up to Marley's funeral.
Some adaptations play with this. At least one film version had half of Camden Town show up to the funeral - so they could celebrate the fact that he was finally gone.
In Stephen King's short story "1922", Hank James of the Sweetheart Bandits has a Lonely Funeral because the townsfolk blame him for the deaths of his partner-in-crime Shannon Cotterie and their unborn child. The funeral is attended by only the preacher and Henry's father and mother, the latter being already dead herself.
In Maniac Magee, Grayson's funeral is shown to have Maniac himself as the only mourner; by the time Maniac runs off, even the priest hasn't shown up.
Supernatural: When John Winchester dies, the only people who attend his funeral (being burned in a field) are Sam and Dean. They invited anyone to said field or even put out death notices through the hunters community. It presumably got around by word of mouth eventually that Winchester was out of the game. Pastor Jim and Caleb would have come, if given the opportunity, if they hadn't been murdered by demons half a season before so the Winchesters would have nowhere to run.
Nip/Tuck: There was a recurring character who blackmailed one of the main cast into giving her more treatments, beyond the point of reason. Eventually, he was asked to give a eulogy at her funeral and was the only one there: she had alienated her whole family.
This is also true of the fake funeral of Locke's father in a season 2 Flash Back.
On That '70s Show, Red has a near death experience and has a dream of nobody attending his funeral, a side effect (according to Kitty) of "calling everyone a dumbass."
Subverted when, in a later dream, Red realizes everyone really is a dumbass, and he'd rather not have a bunch of dumbasses at his funeral.
On ER, when Dr. Romano dies, the only person who attends his memorial service was Dr. Corday.
Sanctuary: When Ashley died, only the core cast attended her funeral. The nature of work at the Sanctuary lends itself to people without many attachments, so this makes sense.
The Shield: Gilroy's funeral only has attendees beyond immediate family because Mackey is trying to help the widow shield her children from what Gilroy really was.
One of the corpses of the week on Bones has only his mother coming to his funeral. Or would have, if Brennan, Booth and the team hadn't shown up.
The A-Team had an episode where the team attended the funeral of a friend of theirs they had served in Vietnam with. Besides the team and Amy, the only people there were the priest conducting the serviceand the man's wife.
A subversion of sorts. The townspeople wanted to attend the vet's funeral but... they were intimidated into not attending by the local town heavies. Who were also the men who killed him.
On the The Golden Girls, when Frieda Claxton, a despised neighbor of the Girls dies, they plan and attend the funeral, being the only ones there. It is Played for Laughs when a woman stops by and reveals that she the deceased was a great supporter of charity, but keen on anonymous work, but she was at the wrong funeral. When the woman found out who she really was, she kicked the coffin, since she hated her as well.
In the Season 4 Finale of Psych, Mary, the expert on the Yin-Yang duo only Shawn, Gus, and an old woman (presumably his mother) attend his funeral.
Leverage, subversion: Sophie apparently gets killed by an IED sent by the villain of the week, and we cut to her funeral, where Eliot is giving her a speech...until he gets to her name, at which point he stutters out one of her aliases. Cut to the crowd, which is actually pretty big.
Dexter: Due to the fact that everyone assumed him to be the Bay Harbor Butcher (instead of Dexter) Sergeant Doakes has a funeral attended only by his mother, his two sisters, and his former partner. Emphasized when the former partner suggests starting up a memorial fund in his name, and everyone looks at her like she's high.
Stargate SG-1: The US Air Force's First Contact team (SG-1) make up the majority of the attendees at a rather unpleasant minor character's funeral in "Between Two Fires". They find out that A) he only would have wanted people he respected there, and since he was pretty harsh no-one really liked him and B) he arranged for SG-1 to be there in order to solve the mystery of his death.
In NUMB3RS, Charlie went to a funeral of a colleague of Larry's only to see that Larry was the only one there.
Spooks: After Ros dies while attempting to rescue the Home Secretary, only the rest of Section D attend her funeral, which causes Harry in particular a great deal of grief. Noteworthy in that of the many, many, people who have died during the course of the show, she is the only one whose funeral is shown in any depth.
On True Blood, only Sookie and Tara attend Eggs' funeral.
A less serious example that soon turns to comedy is on Chuck. Casey pretends to play dead and have a funeral to lure his trio of former teammates out, and agents are supposed to be hidden among the guests attending, but Chuck points out that the only people there are him, Sarah, and the agents.
All in the Family: In "Edith's Final Respects," Edith — to her surprise — is the only one to attend her Aunt Rose's funeral. (This is a twist on the trope, as Aunt Rose was fairly well respected. However, Rose is also very aged and had few surviving close friends or family that were able to attend the funeral, a reflection of real life.)
The first time Lancelot dies on Merlin he gets an elaborate memorial service. The second time (after Morgana brainwashes him into seducing Guinevere and then ordering him to kill himself) Merlin is the only one who attends his Viking Funeral.
On My Name Is Earl one of the people that Earl is trying to make up to just died due to a freak accident with a Murphy bed. They are unable to find next-of-kin so Earl takes it upon himself to arrange the guys funerall. Problem is that they can't find anyone that knew the guy and it looks like he would get one of these.... and then the IMs start popping up on the guy's computer asking where we was. Turns out the guy lived his life on the internet and that all his friends were on there. Earl and Joy managed to figure out how to use a computer enough to arrange a wake for those who can make it as his old apartment. The apartment is standing room only.
On The Wire, Tosha - Omar's partner - is killed in a shootout with the Barksdale crew. Her funeral is sparsely attended specifically because Stringer sent goons to watch it in case Omar appears, and no one else in the neighborhood wants to be seen mourning her in their presence.
Game of Thrones, The Childre- The Nights Watch burn their dead in a massive funeral pyre. Meanwhile outside the wall, Jon Snow burns Ygritte on his own.
"Eleanor Rigby" by The Beatles. The lonely title character dreams of someday being married, but ultimately dies, her funeral service attended only by the equally lonely Father McKenzie.
"The Ballad of Curtis Lowe" by Lynyrd Skynyrd features a quick reference to Curtis's lonely funeral.
On the day old Curtis died nobody came to pray old preacher said some words they chucked him in the clay
Occurs in "Reuben James" by Kenny Rodgers:
Just the Preacher, me and the rain Just to sing one last refrain for Reuben James
In Death of a Salesman, Willy Loman's funeral is attended only by his wife, his sons, Charley and Bernard. He wasn't mourned by half as many as the man who inspired him to become a salesman (and was the subject of the Title Drop).
In L.A. Noire, Cole Phelps' funeral is sparsely populated due to making several enemies in the Marines and the police force. What's worse is that half of those are crooked cops who put him on the path leading to his death, with the guy who ruined his life delivering his eulogy. Only his former company sergeant, his ex-wife and kids, lover and handful of ex-partners are really there for him. And then there's that guy from outside that bar.
In Fable II, Hammer's adopted father, the head priest of the Temple of Light is killed trying to protect Hammer. You, Hammer, and three monk's attend the funeral. Nobody from the town who's prosperity is given to them by the Monk's holy tree, attends. To make matters worse, the monks depart immediately after the prayer, ignoring Hammer as she calls them out for their callous nature and the callous "business as usual" way the world is treating the death of this man.
In Final Fantasy Tactics, the ending shows a funeral for Ramza's sister Alma, attended by a handful of elderly people, who were merely mourning the extinction of the noble Beoulve family. Ramza himself, meanwhile, is condemned as a heretic and denied even a marker (although he is the real object of mourning by two of those present at the funeral). Thankfully neither Alma nor Ramza are actually dead, though only Olan saw this. Although the massive bloody war that just shook the world and killed countless people could be a factor there; all of Alma's friends were dead and the only people that survived the war to come were the old nobles who were safe from the war and too old to fight in it.
The Boss from Metal Gear Solid 3: Snake Eater. The only person who bothered to visit her grave and pay respect to her was Big Boss (Naked Snake). Well, at least he consistently did it, and even during her final moments, he was there. Possibly done to show how shallow the other higher-ups were, and how they didn't really care about her sacrifice. Also, due to the nature of her final mission, she was never even given a proper funeral. She is buried as an anonymous soldier.
In The Order of the Stick, one of the bonus comics in the print volume War and XPs features a very poorly-attended funeral for Lord Shojo.
In There Will Be Brawl, Red's funeral was only attended by Leaf, Samus Aran, K.K. Slyder, and Barbara the Bat. Subverted by the fact that many other people loved him, but didn't attend his funeral because they were out avenging his murder.
In "The Wizard of Evergreen Terrace," Homer imagines himself dying: In Homer's imagination, the gates to the Graveyard of the Future open, where his funeral is taking place. Ned Flanders does the ceremony, while a suited Lenny and two bodyguards, Barney Gumble with his arms full of Oscars, as well as the robot from Lost in Space and Heckle and Jeckle, stand by.
Ned: No, Homer wasn't a great man, nor even an adequate man. And he certainly never accomplished anything. Uh, President Lenny, do you have anything to say? Lenny: Nah. Ned: All right, fair enough. Toss him in the hole, boys. (a dump truck lets loose a mound of dirt, along with the body of Homer J. Simpson, into the hole below. After the dirt settles, his feet stick up, unburied) Heckle: There goes a real sack of crap! Jeckle: Indubitably, old chum! (several dogs start to chew on Homer's feet)
When Bleeding Gums Murphy died, the only person who went to the funeral was Lisa. Marge and Homer didn't even actually attend the funeral, they just waited for Lisa at the edge of the cemetery, Homer buying hot dogs. Reverend Lovejoy didn't even get his name right.
In "The Curse of the Flying Hellfish", Mr. Burns and Abe Simpson are the only people attending the funeral of Asa Phelps. The only reason they're there is that they've entered a Tontine over a set of priceless German paintings that they stole from the Nazis during World War II.
In another episode, when Marge's Aunt Gladys dies, when the family arrives for the funeral, there are many people attending, but when the pastor says that Gladys "wasn't a rich woman," nearly everyone except Patty, Selma, Marge's mother and the Simpson family all get up and leave.
One episode of Freaky Stories featured a wealthy man who wasn't on speaking terms with any friend or relative and made a will leaving his fortune to anyone who bothered to attend the funeral. The only person to do it was an old woman who didn't even know him. She simply needed a bathroom and crashing the funeral was the only option.
Sometimes, funerals of very aged people will be attended by a very small number of people. This is often the case when the decedent was not well known in their community and has very few surviving close family or friends. This is especially true when the decedent's friends and acquaintances are themselves very elderly (and thus likely to be in poor health and unable to attend however much they may wish to). This is absolutely not a reflection of how well regarded the decedent may have been, but simply the realities of the situation.
On the flip side, a very aged person may have been very well known in his community and have many survivors. Again, it is absolutely not necessarily an indication that the centerian who isn't so fortunate to have such a large turnout (i.e., only the number of fingers on one hand is what the number of mourners are) was disliked, but simply the fact that the less well-known deceased may have lived a private, anonymous life and was not well known outside his circle of friends and family.
It's not so much a lonely funeral, but sometimes funerals that are "private" — that is, the service is attended by only those who are specifically and explicitly invited to come — have decidedly fewer people in attendance than ones that are "public." The reasons for private funerals vary, but one common reason is that the survivors want a simple funeral with only the most important people from the deceased's life attending, or the person is of such notoriety that it is best to keep the funeral "closed."
Composer Sergei Prokofiev had the misfortune to die in Russia on the same day that Stalin died. As he lived near Red Square, it was three days before the throng of "mourners" for Stalin had thinned to the point that his body could be removed. There were no flowers at his funeral, as every flower for miles around had been harvested for Stalin's funeral, while only 40 mourners showed up, as his other friends and relatives were too busy honouring the late dictator. (Many musicians mourned him privately instead - supposedly, the tears being shed by the string quartet performing during Stalin's lying in state were for Prokofiev, not Stalin.) Even the memorial issue of the leading Soviet musical periodical of the day devoted its first 115 pages to Stalin, and only made scant mention of Prokofiev's death on p.116.
A well known Urban Legend involved an old woman who needed to use the bathroom in a funeral home, so she wrote her name on the list of people attending to a funeral of some old man. She was the only guest. Later we find out said man was very rich and conflicted with his family to the point he wrote in his last will that all his money will be inherited by people who attended his funeral.
An alternate version of the legend involves the person seeing that the list is empty except for her name, and writing her name because she feels sorry for the deceased.
American founding father Thomas Paine, author of Common Sense, a pamphlet frequently seen as among the influential publications of The American Revolution, had a whopping six people show up at his funeral. Why? He had written a thesis (The Age of Reason) promoting deism and damning Christianity, which was...not a popular opinion at the time.
There are conflicting accounts of what happened to the body of Harold Godwinson after his defeat and death at the Battle of Hastings in 1066. The most romantic one was that after it was located by his mistress on the battlefield he was unceremoniously buried under a pile of rocks by the coast in an attempt to degrade him but his grave looking out toward the sea makes it appear as if his ghost guards England ever after though he failed in life. In any event he died a lonely death for a king and given that it was worth a man's life to say anything good about Harold, only his most devoted friends and family would have attended. And a lot of those were dead themselves.
In the archdiocese of Louisville, there is a "Joseph of Arimathea society" designed to prevent this. They provide flowers and grave side prayers for bodies left unclaimed in the morgue.
When the American author F. Scott Fitzgerald died, hardly anyone turned up, not even his own wife. The service was actually horribly reminiscent of Jay Gatsby's funeral, even down to one of the few mourners calling him a "poor son of a bitch".
One man faked his own death to find out his true friends (the people who showed up at his funeral). The only person to show up was his mom.
Lee Harvey Oswald's funeral was attended by his wife, mother, children, and few else. This is likely due to the funeral being held in (semi-)secret and occurring the same day as that of John F. Kennedy, the president he assassinated, whose funeral was a very big deal. Oswald's funeral attracted so few people, the reporters present were the pall-bearers.
After his death in qualifying at Imola, driver Roland Ratzenberger's funeral was attended by few within the Formula One community. The reason? The legendary Ayrton Senna had been killed in another accident at the same race. FIA President Max Mosley, one of those who did attend, later stated, "Roland had been forgotten. So I went to his funeral because everyone went to Senna's. I thought it was important that somebody went to his."