The Meaning of Life, the Universe, and Everything.
Something like this could work the way you would want:
/execute if @p[name=!boblerbob] run kill @p
If you would like to kill the mobs as well, something like this could possibly work:
/execute if @e[name=!boblerbob] run kill @e
Simply stick one of the command in a command block under a pressure plate and stick a redstone dust under the another pressure plate (if using a 2+ wide door.) and it should be working fine, you could also have this line in a repeating command block which could do the same every tick and within the distance radius you specify around it in a sphere:
/execute if @e[name=!boblerbob, distance=..10] run kill @e
Small warning! If you plan on using the repeating command block, I would suggest testing in another world just incase something goes wrong. So you do not end up ruining you and your players' world with a little mistake.
I cannot verify that those two commands work 100% as I currently do not have access to the game, but it should be working.
Small breakdown just incase you are wondering how it works:
Checks for an entity in a 10 block radius (in a sphere.) and runs the kill command on that entity.