Cycles. Masking objects with shaders (no compositor)
Using Cycles, you can achieve this by combining transparent depth of the light path node and backfacing of the geometry node.
We want to be transparent what has a depth modulo 2 equal to 1, as we want to be visible what is behind the transparent object (all are considered manifold).
But back faces have an additional transparency depth because they can be behind its own transparent front face.
So we add the two (backface + transparency depth) and set transparent what is modulo 2 = 1.
Here is an example:


Note that in the provided blend file, if the two transparent cubes overlap (intersect), the blue one will reappear. But the two transparent cubes together are no more manifold when overlapping.