I've lost a few duplicants this way when the enclosed space has no breathable air - playing on fast speed they suffocate very quickly.
It's likely too expensive to guarantee this in all situations, but perhaps a check could be made to a location likely to be generally accessible prior to building (such as a food storage box); this should mitigate most of the situations. Maybe only when they are in hazardous conditions
Another thing that might help is to raise a 'no path' alert when a duplicant can't access any jobs (instead of showing as idle) [possibly pausing the game if in a hazardous situations - "Your duplicant is in mortal danger!"]
Build a wall that encloses a space. Sometimes the duplicant will build from the enclosed side.