Aye, easily. Many of the posts have here have already used examples that I too would have used to explain what are good and bad examples already, but, yeah, you can most certainly get away with it; there's plenty of games that do so. It's really just a matter of good writing or storytelling, something many games persistently struggle with.
The problem, I guess (and the rest of this post will CONTAIN SPOILERS, by the way), is that games are interactive experiences and, often-times, very personal to the player, particularly in games - not necessarily just fully fledged RPG's - that involve choices, and consequences, which either influence the playable character or the game world in some way. What that creates is a situation in which the player feels that they're the one in control, that they are the one influencing the certain things like the main character, game world, other characters, etc., and I suppose that they then picture an ideal ending based on their experience thus far.
The thing is: games are a great platform for spinning a good tale, of course, but I unfortunately think that this sometimes creates a quarrel between the player's wishes and what the development team wanted to create, resulting in a knee jerk reaction from many people when something that's even heavily foreshadowed takes them by surprise. What springs to mind as an example is Red Dead Redemption. It has one of my favourite endings of a video game ever, but I was shocked when I read all these furious posts on forums declaring that it was a really shit ending, despite the foreshadowing from conversations with various characters about certain themes of the game; the "Strange Man" / Devil quests with their obvious allusions to what will happen; what certain characters represent (e.g. Ross as the approaching modern age and John himself as the dwindling Wild West); et cetera. Where the knee jerk reaction originated from is probably that, to a certain degree, you have enough influence on the game world and to your experience as John through several choices, some big and some small, that you really believe that all will end as you expect that it should in an ideal world, despite the killing off of characters like the young Mexican girl who was in love with the rebel to disprove such thoughts.
But, as I say, that isn't a bad ending to me, nor are others that have been mentioned either. The whole game is bloody well written, and that's all you need in order to pull off such an ending in any game. Another example, that I don't believe has been mentioned, criminally enough, is Spec Ops: The Line. There's not a single good ending in that game yet they're all really brilliant. Surprisingly, I don't believe I ever read any backlash over the game for not having at least one ending where there's just a hint of redemption, which perhaps suggests that we're getting used to notion that we can't always have what we want, no matter how attached we become to our perception of the game or how we want it to end. Or maybe not, I don't know. Games can get away with it, for sure, if the writing's good enough, but I suppose you can't please everyone.