The building can usually still be sold, but the buyer's solicitor and lender will require a retrospective opinion on compliance from a suitably qualified professional, and any planning or building regulations breaches must be resolved or insured.
A professional can inspect and issue a retrospective opinion, but they can only certify what they can see or reasonably infer. Elements now hidden, such as foundations, insulation or fire stopping, may need opening up or may have to be excluded.
Where a genuine breach exists and enforcement is time-barred, indemnity insurance is sometimes used to satisfy a lender, though it protects against enforcement cost rather than making the building compliant.