I know of two main techniques to achieve this, which most games use with some variation between them:
1) Procedural or voxelized "filler" mesh.
- Model your walls as simple 1-sided "planes". By design, 1-sided surfaces can only be seen through one side, as faces with opposite normal are ignored in render. Optionally, but highly recommended, is making these in modular sections.
- Fill the space behind the walls with procedural meshing of some sort, either as "roof" (plane) along the top of the walls, or as solid.
- Depending on the look&feel you want to achieve, you can give this filler a solid opaque color (IE pitch black), or have it with a material similar to the walls, to "blend in".
This is the technique used in games like Evil Genius:
2) Make your lighting work with the "wall" meshes and the procedural nature of the game by design.
- Make your "wall" meshes like in the first technique; meaning one-sided, and preferably modular.
- Don't use global illumination at all. Instead, make lighting be localized to the player, and/or enemies, and/or proceduraly-generated together with the walls, in pieces. Make it never be generated above the top of the walls. And make each light never exceed the "thickness" of it's own section (two corridors running side-by-side shouldn't "bleed" lighting to each-other).
- Profit. The game gives a "dark theme" to the spaces outside the walls by design.
As far as I can tell, this is the technique used in (some areas of) Path of Exile: