So how do you write it?
I use the former. Some people might say that the latter is more correct (one doesn’t refer to a pigfarm, after all), but we’re not really farming wind here. That we leave to the bean farmers (hohoho; I do believe that was the very same joke that Lord McAlpine used to use when showing bigwigs through the RES Ltd office in Hemel Hempstead).
I’d really prefer to use the term windpark, using the original meaning of park for an enclosed field. I guess it’s a bit European for most folks here, so it’s windfarm for me.
(One shouldn’t confuse a windfarm with WindFarm, the toolbox of choice for the leet wind haxx0r).