How do I "block off" an area with command blocks?
You could do it by TPing all players not in a specified team away.
Add all players that you want to access the area to a team:
/scoreboard teams add [team name]
/scoreboard teams join [players...]
Then you need a command block in Repeat mode in the area, you can use needs redstone or always active, but I would suggest that you at first run a redstone wire with repeaters and a lever at the end for testing.
Repeating command block command:
/tp @e[r=[range in which players cannot access the area],team=![name of the team that can access the area]] ~40 ~ ~ [you can change the location]
Example:
/tp @e[r=10,team=!access] ~20 ~ ~
You would need to continuously /testfor the area to see if people are in the specified range, etc.
Then you'd link the /testfor command-block to another which teleports the player to somewhere else.
And the good thing about this, is that even if they teleport-in or walk-in, they'll be teleported either way... or is that what you wanted?
Hopefully, my answer assists you in your endeavours.