The key to avoid these types of situations is to know your market very well, and to have a very good grasp of the potential/future movement of your market.
That usually requires a bit more than driving around the area for 12 months, reading magazines for 24 months, or hanging out on this forum...