The hotel owners want the revenue and don't want to lose customers -- including the prostitutes, many of whom are paying a discounted rate but still paying for room and F&B, often with a roommate to keep costs down amongst other things.
So as long as the police aren't called in to resolve a disturbance involving a prostitute at a hotel, the police don't enforce the law because their bosses' bosses have social and business ties to maintain and sustain that also involve the same as other hotel owners.
Keep in mind that the UAE is a small country where it's citizens are a small minority of the population. This has come with relationships amongst the clans/tribes and even intra-family being so interwoven and yet sensitive that nationals have to walk on egg shells when dealing with other nationals because it's sort of hard to keep track of whose cousin just married the bosses' sister and who is the bosses' favorite spouse and kids at the moment. The consequence is that the lower level police aren't going to rock the boat and the upper level authorities want peace in the house and don't want to risk shattering the peace amongst the extended relatives by depriving a group of its national of money from investments unless they really feel they have to do something.