Do UK universities have a special obligation to advertise jobs externally? I often hear it said that all jobs have to be advertised externally before anyone can be appointed to an academic post in a UK university. However, this rule about having to advertise externally is certainly not true in general in industry where the only obligation one might have to avoid discrimination claims is to advertise the job internally.

Is there a special obligation on a UK university through some public sector regulations, maybe, to advertise all jobs externally?  I'm asking about UK universities in particular.
I think you are misunderstanding how academic job searches work in the UK. All jobs, and I believe this is not specific to universities, must be advertised internally first to individuals in the "redundancy pool". If, and only if, there is no one in the redundancy pool that can meet the minimum requirements with 6 months of training can the job be advertised externally. The redundency pool is available to people, I think, from 3 months before their contract ends until 3 months afterwards.

Current employees not in the redundancy pool, can get prompted within the same job family without having to advertise the job at all. At my university there is no system for moves, lateral or upwards, across job families. That said, if you really want someone, you can regrade and reclassify them.