How to hide an object in front of a mask instead of behind it?
You can enable the X-Ray option of the Cube and the green mesh, so they will be visible infront of the red mesh as shown below:



As shown below I made a scene with a red monkey and a green cube where the monkey is in-front of the cube.



This is the result of the rendering:



To avoid the red monkey from appearing while rendering then you un-click the render button of this object as shown below:



This will be the result of rendering: