I'm not sure how you were found/attacked/killed, but I'll assume you weren't defending/retrieving/raiding/walking up on an enemy/talking smack/supporting others in a PK situation (either attacking or being attacked by foes) etc. Because those are reasons to be killed again. I'm also assuming that you did not see your foe in the area before the attack and when you were attacked, you tried to gtfo immediately and not try to fight the battle. Given all that...
There are classes/races that can give you the ability to detect and/or conceal yourself from your foes. And a couple that will allow you to go afk for extended periods without fear of being attacked or to travel and regear without fear of being followed and/or get away without being killed.
Transmuter
Thief
Assassin
Shapeshifter depending on focus/forms (burrow, camo, hide, air forms, detect hidden, detect camo)
Druid
Healer
Invoker
Etc...