Death Be Not Proud
One of the basic concepts in most RPGs is that your character can die, whether or not you want that to happen. It’s so basic that in most RPGs, it goes unquestioned, and shows that the idea that there is no winning or losing in an RPG is simply not true. There is losing, at least -- either when your character fails at an important task or when your character dies. This is the game element of an RPG. It’s difficult to have a game without a fail state. I get that.
But the problem with death is that sometimes, a character’s death is inconvenient and boring, not just for the player, but also for the rest of the table.
So here are some alternatives to character death:
Your character continues to show up in flashbacks, perhaps prompted by dreams or a journal. This is a short-term solution, but a workable one for a campaign nearing an end, particularly if the challenge is mystery-based rather than combat-based. You can still help the group solve the mystery.
Your character is mortally wounded, but it doesn’t show and the effects are delayed. The wound appears to be not as bad as initially thought, but at some point, perhaps after this quest or that storyline, your character will drop dead. This works for those of us who love closure.
Your character lives due to the intervention of someone terrible, and now they owe them a debt. Perhaps the evil priest casts a heal spell on you, cackles, and says something ominous like “We have plans for you.”
Your character lives but changes in some fundamental way. Your character might lose something important to them or be maimed.
Your character does die, but comes back as a ghost, revenant, or some other kind of haunt, whose spirit can only find rest when the mission is complete.
To work this into a game, just talk about it with your fellow players. “Death” in a game still changes your character, it still has consequences, but those consequences don’t have to be the immediate end of the character.