How to make everything inside a 3D box visible and outside of 3D box invisible

What you’re looking for is a version of what’s called “fog of war”. You can do this using a post process volume.

This video introduces the concepts surrounding it, but you’ll need to change it to get the exact effect you’re looking for: