Not bad...assuming:
1) you're not in an area that prevents teleporting. And there are lots of those in published settings/adventures, so it's not like you'd only see this from a RBDM.
Cone hat cuts off line of effect from Dimension Lock and other anti-teleportation spells. If you're talking about a situation where DM fiat says "teleportation does not work, no ands, ifs, or buts," you could always escape by burrowing through the earth via polymorphing into the correct form, etheralness, or something else creative.
2) you still have that T-port available (ignore 2 if it's a contingency, of course.
Or a scroll!
3) you don't mind potentially never seeing the party again.
1. Who said anything about retreating? Teleport out refers to teleporting out from under the cone hat. You can still end up in the field of battle. For example, if you're being ambushed in the open plane, you could TP up a few hundred feet and rock the battlefield with spells from the high ground.
In fact, if you stow some Shrink Item'd boulders in your spell component pouch and use the rules saying retrieving spell components is a free action, as is releasing held items, you could conceivably start dive bombing the fool who used an AMF on you, since the Shrink Item will wear off once it hits the AMF.
I figure the Greater Stone Golem covers what comes up in "etc".
For every tactic, there is a countertactic.
The rogue in question- well, one of them, at least- was not just a random foe or part of a set piece, he was an assassin hired by a bitter rival. He spent 2 years of campaign time observing his target and preparing...and aaaaalmost completed his mission. He DID die trying, though.
I can believe that. I'm not saying a rogue
couldn't do it, but I do believe that if you're going to take it to the max, the side with more spellcasting power comes out on top. Someone who can Plane Shift to a plane where 1 year of time equates to 1 round on the Material Plane and who has spells that allow him to play a game of 20 questions with deities is going to be hard to surprise.
Granted, very few people actually play this way...
Nobody is 100% prepared for every threat 24/7.
Batman, if TV tropes is to be believed.