Let's try to be logical here.
1) The safe: Is it big? Can this player really move there? I think not, so this is a situation where DEX bonuses will not apply.
2) Attacks: The safe has it's own HP and DR, so if a weapon of an NPC can't do any damage to the safe, the player is safe. However, if a weapon can damage the safe, the safe must be destroyed (or at least badly damaged) before an NPC can hit the player.
The character can't be fully invulnerable just because he locks himself in the safe, but there are still a few perks. If a weapon can't do damage to the safe, it follows that it can't do damage to the player, since it didn't pierce the safe. However, if it can, it needs to pierce the character's armor as well as the safe, which means the first successful attack doesn't actually hit the player.
Let's remember what the HP of an item is. The HP of an item is something that designates that the item can still be used as intended. A broken door that was destroyed by weapons will not become flinders automatically, but that door having 0 HP means that it can't be used properly again. This could be accomplished by breaking a big hole in the middle of it or breaking it's hinges.
Now back to our safe. If a weapon doesn't have some kind of property to pierce shields, it can't pierce the safe without bringing it to 0 HP. However, there is a possible way to get in the safe. If there a spot where someone can use a piercing weapon to get through the safe, it may be able to reach the player inside. We can compare this situation to bloodied state in DND 4e. Bloodied is a HP state where character actually receives an open wound. The same rule can apply for an object. A person inside an object still can't be attacked by slashing damage, but the object can be pierced by spear or rapier and hit the player inside.
Again, in that case his AC without DEX mod (or with penalties if we're talking about 4e DND). If the safe is broken completely I think it's a situation where the player needs to spend his action to stand up properly. After that it's a regular combat situation.