It happens quite often. A piano job vacancy is advertised, people mail in application materials, and then an inside candidate gets hired. Which usually means the person was selected before the ad was even written. It seems a bit silly to advertise a filled position, but the act serves a purpose beyond toying with job-seekers. In many cases, an ad must be published to satisfy a human resources policy requiring an official advertisement for each job (giggle factor: the policies exist to ensure fairness in hiring).
I have no problem with the morality of pre-hiring. My issue is the time taken to apply for a job that doesn't exist.
I propose that a code be invented for these occasions, some clever turn of phrase that clearly communicates 'this ad is just for show, no job here'. Some suggestions: insert the phrase "preference given to our own candidate"; specify candidate requirements to an obvious degree (5'9", mid-thirties male with DMA in X from XXU, brown hair, blue eyes and 2 dogs preferred); insert 'not' at the beginning of the entire ad (XXU is not looking for an accompanist). Or just tack on "No one is encouraged to apply" at the end. Win-win!