I am planning to buy a Xiaomi iot device which need to connect to Xiaomi bluetooth gateway. Can i connect the Xiaomi iot device to the Raspberry pi 4 (built in) bluetooth instead of connecting to the Xiaomi bluetooth gateway?
You don’t tell what device. Some Xiaomi Bluetooth devices are reversed engineerd, like the miflora and most temp/humidity sensors. Those will work, others not, unless you have the skill to revers engineer them.
Door sensor
I have never seen a possibility to use a Xiaomi bluetooth door sensor with HA bluetooth.