What you can do is using the Cryptomatte in the Compositor. First you have to enable it in the View Layer Properties, under Passes > Cryptomatte check Object.
![enable cryptomatte pass](https://cdn.statically.io/img/i.sstatic.net/bsxpC.jpg)
Now you can render the image (and you don't even have to set the background to Film > Transparent when using Cryptomatte) and go to the Compositor. Make sure Backdrop is enabled since you need the Viewer node.
Now add the node Shift+Add > Add > Matte > Cryptomatte (not Cryptomatte (Legacy)!) and plug the Image output of the Render Layers node into the Image input of the Cryptomatte node. Plug the Pick output into the Viewer node.
![cryptomatte pick](https://cdn.statically.io/img/i.sstatic.net/nO9ev.jpg)
If you now click on the Plus symbol next to the Matte ID field of the Cryptomatte you'll get an eyedropper tool with which you can pick an object in the image. Hovering over an object displays its name. If you click on it, it gets added to the Matte ID list.
![adding matte id](https://cdn.statically.io/img/i.sstatic.net/zwPPJ.jpg)
By the way, this would also work if the Cryptomatte node was not plugged into Viewer, if you view the original render - you just need the Viewer to display something where you can pick from.
Now after you picked the yellow and red cube in this example, their names are in the Matte ID list. If you change your mind, you can always choose the Minus symbol to pick objects you want to remove from the list or add more with Plus (if there were more objects in the scene).
If you now plug the Image output of the Cryptomatte node you can see the result: the image is masked to only display the picked objects. Not only the blue disappeared, but also the background although it was not set to Transparent.
![masked image](https://cdn.statically.io/img/i.sstatic.net/KjakK.jpg)
But since your goal was to have the blue cube visible but remove it from the Alpha channel, you can use the Matte output of the node to get a black and white image of the masked result (sorry mine doesn't look white, I have Filmic enabled):
![matte output](https://cdn.statically.io/img/i.sstatic.net/evHVL.jpg)