Alternately, if you need a color matte rather than an alpha matte for something like Nuke you can give your object an emissive color of 1 that is only visible to the camera
Ah very cool, thanks to you both, holdout shader does exactly what I want.
BUT now the scene got quite dark and no reflection is visible on the water. I tried it with a mix node, but looks like holdout can just be used alone.
How can I achieve the same effect as the holdout shader does but with no light loss and with reflections of the walls in the water?