How to render with alpha-channel defined by object form?
The holdout node can be used to cut an object from the scene.


  The Holdout shader node is used to create a “hole” in the image with zero alpha transparency, which is useful for compositing


Note that the holdout only cuts through objects in the scene, you need to render with transparency and composite the scene onto the environment pass if you want the background.

You can also set the object pass index and use the ID Mask Node to mask it out in the compositor. The material index is the same thing applied to the material instead of the whole object.