Getting polygons of all countries and ISO-3166-2 subdivisons
This site may have what you are looking for:
- http://www.gadm.org/ and http://www.gadm.org/country
You can find a script inspired by MvG's answer and a few examples here : https://github.com/laem/regions-topojson
Sadly, not all geonames administrative relations are tagged with iso-3166-2...