If somebody doesn't deserve something good, but gets it anyway, you can say, "You don't deserve that." In this case, the word "that" refers to the good thing.
And:,
If somebody doesn't deserve something bad, but gets it anyway, you can say, "You don't deserve that." In this case, the word "that" refers to the bad thing.