How to achieve transparent occlusion?

Like unity:

You could base the technique on
Here when the refractive box in the middle is rendered, it grabs what was already rendered behind it into a texture, and uses a custom shader to render with. So that bit would work for you, as long as you fix the custom shader in that example to not distort the uv coordinates.
What you need to do next is to not use already rendered texture, but render the scene into different texture, using the same camera, but different rendering mode (transparent materials …). This is probably the most similar example for this: