Rendering certain objects with transparent background.

What is the best way to render certain objects in a scene with a transparent background without hiding everything else.
I did this with custom depth pass and making a green screen in the post process volume, however now I need the renders to be using path tracer and the green background reflects on the objects and they are unusable.

Any other way or suggestion on how to do this?

Transparent as in you need a clean matte with certain objects on it and nothing else?

Yes, basically till now I do it like in the green picture and i remove the green screen in post.
Bu whatever solution works