In fact, often clinical trials are statistically analysed by intention-to-treat, including all people who have been randomised even if they later don't receive the treatment.
Per-protocol-analysis (including only people who follow the study protocol) can also be used but it is more prone to bias.
Besides, with masks it is not simply wearing or not wearing a mask. Even a very diligent mask wearers may wear it in a way that makes it less effective without being aware of that.
In short, when the doctor prescribes a medicine it is important to understand the factors why the patient may not take the medicine as prescribed. If the real life situation is that most people take medicine in a way that makes it ineffective and so much that the clinical trial cannot find significant effect, then he shouldn't prescribe it. It is just a waste of resources and giving people false hopes.