My guess is that the computer looks to see if the siren is actually present and likely just uses a resistance (current flow) test to verify. So, just like you may need to do for substituting an LED bulb to keep the system from faulting that there's no bulb there, if you put a load resistor across the leads, it would likely think it's there and not switch to the horn.
This switching of functions is part of many BMWs, and probably other cars. If the car senses that the normal brake light(s) are out, or the rear hatch is open, it will activate the bulbs in the bumper to ensure there's rear lights and brake light functionality.
By leaving the alarm functionality (less the sound) active, if someone were to break in, it would still disable the car from running.
FWIW, if you're trying to do this to enable you to keep a pet in the car while you make a quick visit to the store, you can disable the internal motion sensor, but leave the rest of the functions active. That's discussed in the owner's manual.