This is not necessarily fallacious. It in fact has a long history in deontic logic, dating back to Leibniz's formulation of deontic logic.
Deontic logic has two 'symbols' on top of regular logic - one representing "is obligatory" and one representing "is permissible". There are rules of inference between the two, e.g. if x is not permissible, then not-x is obligatory, if not-x is not obligatory, then x is permissible.
It has been noted that "is permissible" works similar to "is possible" in modal logic, and "is obligatory" to "is necessary". This observation led Leibniz to define deontic operators in terms of modal operators as follows:
- "x is obligatory" means that the good man necessarily does x.
- "x is permissible" means that the good man might do x.
- "x is forbidden" means that the good man necessarily will not do x.
From these it is possible to derive the conclusion that we should not do something that we cannot do as follows: if x is impossible, then it is impossible for the good man (i.e. the good man necessarily will not do x). If it is impossible for the good man then by our definition it is forbidden. So everything that is impossible is forbidden.
The inference isn't the problem, the problem is when the inference is not justified.