Two bugs with farms and building destruction:
The first is at the start of a game build a city near the farm patch and build on all possible tiles. Then research the farm tech. When the farm tech is available destroy some buildings to leave room for the farm. The problem is the farm building won't be available to build. It only becomes reavailable to build when the city levels up to a hamelet or to the next level.
When it becomes reavailable (or in a new game) build the farm on the farm patch then destroy it. There again the farm will no longer be available to build untill your city levels up.