I had some luck:
a) Enable Cryptomatte renderpass:
b) Render, and add nodes like this:
That is just to pick the colors. So pick an object you want to isolate (I will pick the blue box)
c) Use now the matte output :
And there you have your mask.