Can a village be underground?

Not completely, no. You will need some sort of air shaft.

Villages, in Minecraft, are just a collection of doors that meet the condition of having more spaces on one side exposed to sunlight (This page on the Minecraft Wiki goes into the details). This means that a village/Iron Golem farm without any skylights won't work, as none of the doors placed will count as Village houses. The closest you can come will involve either open shafts, or else glass or something similar in the ceiling.