Touma from A Certain Magical Index has terminal bad luck and a negative outlook, but will fight until the end for anyone he cares about.
In Puella Magi Madoka Magica, Akemi Homura seems to be this. She knows that whenever she resets time to prevent Madoka's death, it always results in things getting worse; Madoka either dies again or becomes an increasingly powerful witch. Kyubey even points out that all she's doing is making Madoka into a stronger witch. Yet despite everything, she never stops trying. She also knows there's no hope for Sayaka, who is fated to die in every timeline, but she still saves her life (for the moment) by retrieving her Soul Gem after it's thrown onto a truck.
In Hajime No Ippo, in the second match between Ippo and Sendou, Sendou is hit by a full Dempsey Roll by Ippo, seemingly ending the match. But he gets on his feet again. He already knows he has lost, and he still refuses to drop to the ground or go unconcious, just so he can watch the face of the man who defeated him.
Aberforth Dumbledore in Harry Potter and the Deathly Hallows is convinced that Voldemort is going to win and advises the heroes to give up and flee the country. Naturally, he still shows up to fight when push comes to shove.
Rincewind in the later Discworld novels, in particular Last Hero.
Crowley in Good Omens. At one point, when Aziraphale has gone missing, the Apocalypse is beginning, and it looks as if there's no hope, Crowley thinks he might as well drink himself into a stupor while he waits for the world to end. Instead, he drives at top speed to Tadfield to avert the Apocalypse, holding his burning car together through sheer force of will.
Most of the main characters (especially Frodo) in the later parts of The Lord of the Rings. Several people get speechs to the effect of "We're pretty much finished at this point, but we're going to carry on because what else can we do?"
Usually he's anything but this trope, but in Luke Skywalker and the Shadows of Mindor, the titular character experiences a severe And I Must Scream, after which he is deeply shaken and nihilistic. It comes up several times that he no longer sees the point; even if his side wins the book's conflict, ultimately it won't even matter. And yet he keeps going and continues to be compassionate, because someone has to.
In Peter Pays Tribute, Peter is convinced that he will never finish the tasks his god demands of him, but he refuses to flee. this is partly out of cowardice, but partly out of a sense of duty, even if his task is impossible.
The narrator of William Ernest Henley's "Invictus."
Atticus Finch knows full well that the racist jury will never acquit Tom Robinson, a black man, even if all evidence points to his innocence. He gives his all in defending him anyway, because no one else will, and it's the right thing to do.
The Aiel of the Wheel of Time series have this trope ingrained in their culture due to prophecy about "He Who Comes with the Dawn," a Destructive Savior foretold to unite and lead the Aiel people, but also destroy them.
In 16 Blocks Jack Mosely fully expects to be killed along the way but he is determined to get the witness to the courthouse to testify. Even if he succeeds the witness's testimony will incriminate Jack as a Dirty Cop and send him to jail. His only real chance to walk away from the whole mess is to let the witness be killed but that is the one thing Jack is determined will not happen.
Ryotaro Nogami, the protagonist of Kamen Rider Den-O, willingly admits that he's not very strong or smart, and that he has insanely bad luck. That doesn't stop him from doing his job and protecting the timestream, which results in his eventually Taking A Level In Badass.
In Lexx, a number of the Brunnen-G decide to stand and fight against His Divine Shadow, fully aware that they have no chance of success. An in-show musical touches on this a bit more, and even inspires the protagonists to take on a similar attitude.
It matters not if the cause is lost and we cannot stop the tide. We will fight to the end, and then fight again. It will be a good way to die.
Al friggin' Bundy. A dead end job, an indifferent family, a shrew and her cuckolded husband for neighbors...he just keeps chugging along without resisting the temptation to put a gun to his head no matter how bad things get.
A few Within Temptation songs have this feel. In Deceiver Of Fools, the subject knows just how bleak the situation is, yet manages to keep that hint of hope. Then there's "Pale" and "Stand My Ground".
Max Payne goes through the entire first game knowing perfectly well that there are only two outcomes for him: either being killed during his Roaring Rampage of Revenge or being put away for life upon completing it. In fact, after he goes free thanks to The Man pulling a few strings, he considers himself to be a Karma Houdini.
Javik in Mass Effect 3 believes that Shepard's cycle is doomed for failure. However giving up is not an option for him, especially after his race and civilization sacrificed themselves just to get him to this point.
Also Commander Shepard, by the end of the series. Case in point is his/her reaction when the Reapers first invade and s/he's asked how to stop them.
In Hakuouki, Hijikata is fully aware that the balance of power is shifting away from the shogunate and that the Shinsengumi are on the losing end of things, even before the Boshin War has officially kicked off. Nevertheless, he gives it every possible effort, sticking with the fighting from Kyoto all the way to Hokkaido and the war's bitter end even when all of his comrades have died or gone their separate ways.