Farms can only appear in low density Industrial land with low land values.
Roads must be placed along at least one side of the farm, but if roads surround the whole zone no farm will develop. The air and water pollution should be as low as possible, and you can't build a farm on an area where dirty industry once was if the pollution hasn't all disappeared. It might be a good idea to enact the Farmer's Market ordinance too. To keep the farms in your city, there are several things you should do. One thing you should do is build farms in low lining areas far from town, and to keep it far away from your power plant.