There is a Lua script which does something similar
Lua scripts for OBS Studio. Contribute to norihiro/obs-lua-scripts development by creating an account on GitHub.
github.com
Description: """
This script provides a filter that hides its applied source from the program.
This will be useful if you want to display something on the preview but not on the program.
This filter will do these things.
- Overwrite rendering function so that nothing will be rendered if it is active.</li>
- Hide an associated scene item.
Info: If you enable "Duplicate Scene" on the transition settings,
the source will be hidden from the program but still shown on the preview.
Known issue: If there are two or more scene-items showing the same source,
this filter cannot change the visibilities of all the scene-items.
"""
From the description it seems that you need to apply to each scene item there is on the scene, I did not test it, but maybe you can attach a filter to the scene itself.