Learning that a transaction is prohibited does not by itself establish that it produces no legal effects at all. Classical analysis separates the wrongfulness of an act from invalidity or corruption of the contract.
A defect may concern an essential constituent of a sale or an attached condition. In Hanafi law these distinctions underlie the different classifications of bāṭil and fāsid transactions, with distinct consequences.
Necessary caution: The single word “prohibited” does not automatically classify a particular transaction as valid, corrupt, or void; the nature of its defect must be established.