The best prevention is to make sure that all pipes are installed in protected areas where they are not vulnerable to the cold. In existing homes, a plumber can be used to re-route the pipes. It is a permanent long term investment that pays off well. However, this is a big initiative that takes both time and money.
Insulating the pipes can reduce the heat exchange and prevent them from freezing. It works the same way as warm clothes for humans. Insulating material like insulation sleeves and wrappings can be installed around the pipes. This will slow the heat transfer.
Hardware stores have insulation material in different thickness varieties made up of rubber, asbestos and fiberglass. These can be easily installed around the pipes using tapes. Insulating material is usually available in rolls and can easily be installed by home owners themselves. The rolls can be cut according to requirement with scissors.
Open up a faucet that connects to a vulnerable pipe and allow a small volume of water to drip through. Keep this faucet open. A tub or container can be placed under the faucet to conserve the water. While the dripping faucet might not be able to prevent freezing altogether, it will definitely slow it down as moving water resists freezing. The movement will also prevent any bursting because the dripping allows the pressure to be released from the pipe.
Cold air contributes a lot to the freezing. If pipes are protected from the movement of cold air, the freezing chances will lessen drastically. Check for holes and cracks in the basement, attic and the crawl spaces around the house just before the start of the winter. Now cover these holes with insulation material and block the entry of air through them. Once the air is prevented from entry, the air inside will warm up and this will discourage any freezing.