You can draw, to a render texture, only the objects that are obscuring the view of the player and then draw the player outline to that render texture, clipping it to the obscuring objects.
What you have on this render texture is just the outline where the player and the obscuring objects overlap.
Then, you can draw that render texture to the main render target (likely to be the window) and it will be just drawing the outline and only the outline that overlaps the obscuring objects.
If your issue is determining which objects overlap the player, you could simply draw all of the objects to that render texture that you would draw in front of the player. Then, the clipped outline would still give the same result: the outline at the only parts where the things in front of it would be overlap the player.