No, you can’t. By law, sellers must make certain disclosures about the property to potential home buyers. For example, the federal government requires sellers to notify buyers about lead paint in the property. State disclosures vary by state, but typically require the seller to disclose known structural problems, defects with the HVAC, electrical and plumbing systems and known code violations. And, if the buyer asks, you have to tell him about code violations openly and honestly, regardless of disclosure law. Closing a deal without making the necessary disclosures can bring a heap of trouble. At the very least, you’ll have to compensate the buyer for any financial loss.
In any event, the code violation usually pops up during the buyer’s due diligence period. If the buyer doesn’t find it, the title company probably will when it checks the county records.