Trick Macbook to not recognize HDMI connection with external monitor but still mirror the screen to it I am not even sure if my question is achievable or completely dumb.

I connect my macbook air (macos High Sierra) to an external display via HDMI. As you know whenever you plug the cable in the laptop the new external monitor/ TV is recognized in System Preferences.

Is there a way to send image to the external display and at the same time not recognize the HDMI connection? I have software that stops running whenever an HDMI connection is established and am wondering whether there is a way to trick it?
No, it does not technically make sense to send an image to the external display while at the same  time not recognizing the HDMI connection.

However what can be done is presenting an environment to the specific app where it is not told about the HDMI connection:

An easy and practical way of doing this is to run the app inside a virtual machine (using software such as VMware Fusion or Parallels Desktop).

An better, but more involved, approach is to override the specific library functions that the app uses to inform itself of the HDMI connection. The overriden functions would simply hide the fact that an external HDMI connection is made. Creating such an override usually requires programming experience in order to create what is essentially a shared library. The library could then be loaded using the environment variable DYLD_INSERT_LIBRARIES when launching the specific app.