There are four types of insurance write off. If a car has been involved in an accident / theft / fire and it cannot be repaired economically depending on how severe the damage is the insurer / inspecting engineer will assign a catagory of repair.
A and B are usually for vehicles that have been totalled and cannot be repaired.
C and D are for vehicles which are repairable but the cost of doing so is un-economical.
The vehicle can be repaired, however an insurer would rather pay the value of the vehicle rather than have it repaired because it is cheaper to do so.
If you are sold an insurance write off, the seller MUST legally inform you that the vehicle has been previously written off. The vehicle must also be repaired and must pass an MOT before an insurer will insure it. You must inform your insurer that the vehicle is a previous insurance write off.
You may be able to check the vehicle under a HPI check and I would always do this before buying a used car.
Also get your insurer to look at the MIAFTR register.
The thing here is that the dealer has to inform you of this. If they don't they are in breach of the Sale of Goods Act which says that the goods must be "fit for purpose". If a previous write off is sold on then they must let you know.
Contact your local trading standards office if you have problems.