I've hang out with my fair share of taxi drivers around the world (mainly Europe and South America) but never once heard of them being forbidden of not accepting customers, and heard plenty of stories when someone really fucked up tried to hail them but they declined. It doesn't mean it's not forbidden, but hard to reconcile my understanding.
What places are you specifically thinking about where taxi drivers are not free to chose their customer?