turning the black to alpha in texture node
To the best of my knowledge the only thing you can do in a shader is to use the texture as input to the alpha input of a shader node that supports alpha input, like the principled shader node.  Here's an example of a red ball behind a brick wall:

Here's the simple shader for this.  Note that I inverted the color of the brick mask before feeding to the alpha input of the principled shader.  Otherwise, the mortar would have been black and the bricks transparent:

Note that if you are going to render this with EEVEE you need to go to the material settings and change the Blend Mode to Alpha Blend: