What factors make it difficult to prevent nuclear proliferation in countries like North Korea, Pakistan and Iran?
A country needs three basic elements in order to build an atomic weapon: Plutonium or the capacity to make it, scientists with the know how to produce it, and large scale enrichment facilities and engineering labs. Believe it or not, the easiest of these to come by is Plutonium.
This man made element originally designed for nuclear weapons is also the main fuel for most of the world's nuclear power plants, so there is an abundant amount of the material in the world, and records are not always accurately kept as to how much is around. While conditions in Russia have improved in terms of nuclear security in the past ten years, for a time, and if you had enough money, it was not difficult to buy some on the black market in that country.
When it's all boiled down, there are only one option for preventing a country from getting nuclear weapons for the long term: military invasion. Since this is often neither practical nor desireable, most countries resort to sabotage and sanctions, both of which can only delay the acquisition of such weapons. Some countries, including Israel and the United States, have also resorted to targeted assassinations against nuclear scientists in Iran and elsewhere. Again, this only delayed their programs.
If North Korea, one of the poorest and most isolated countries on Earth was still able to develop atomic weapons with almost no outside help, then any other similarly determined country will be able to, including Iran. Unfortunately, the consequences in terms of the nation's economic health and world instability may far outweigh any extra influence or security Iran might gain from such a move.