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

No because I don’t want to have the minimap in some different scene, I want to have it like a sort of miniature model inside my scene like this.

How could I do the mask thingy you mentioned?