Hmm, interesting problem.
If your agents are only repathing when a wall is placed and new spawns reuse that existing path (good optimization) then the old path would be considered valid and you could indeed block the active navmesh realtime until you call another manual path update when a block is successfully placed. So you could just place a dummy block that does actually block the navmesh, test a fresh path for impossibility, then use the return to dictate if you can or cannot place the block.
This method would not work if your agents are actively repathing, since you change the navmesh pathability directly.
Make sense?