What should you do if you are forced to enter restricted or prohibited airspace?
Even if ATC can't legally give you permission to enter prohibited airspace (they sometimes can for restricted airspace by the way), if you declare an emergency they will still coordinate with the controlling agency which will help to keep you safe.  

Squawk 7700, fly as high as possible, turn on all your lights, broadcast your intentions on 121.5 if you aren't talking to ATC, and don't make any sudden dives toward the ground/buildings, etc.  This will all help to show that you aren't trying to "sneak in under the radar" and can only improve your situation. 

Don't be surprised if you get intercepted though, and make sure that you talk to them on 121.5 if you do.  Know your intercept procedures (section 5-6-2) and follow them exactly.  They will most likely try to help you as much as possible.  You will still face a lot of questions and probably even certificate action when you get on the ground though because, as you said, poor planning is no excuse....

Also, this applies in the US. Some other countries (possibly Cuba, Iran, etc.) tend to be far more sensitive to issues like this and may "shoot first and ask questions later".