You can do this with the depth buffer.
This shader will cause an object to write its depth to the depth buffer, without actually drawing anything.
Any content behind this object's front faces that tries to draw after it in the rendering order will fail the depth test and abort drawing those pixels.
If you need some content to be hidden but not others, then one way to solve it is to play with the Render Queue for each material - sandwiching this material before the object you want to hide, but after the objects you want to show through it.
Shader "Custom/DepthReserve"
{
Properties
{
}
SubShader
{
Tags { "RenderType" = "Opaque" "Queue"="Geometry-1" }
LOD 100
Blend Zero One
Pass
{
}
}
}
If you want to be more selective about what gets hidden / not, then you'll likely want to modify the shader of the object being hidden, to eg. check the stencil buffer or do a test against a custom render texture to determine whether it's allowed to draw here.