They all mean almost the same thing.
"On a farm" means you are physically standing ON the farm's land.
"At a farm" just means "The farm is where you are at(now)"
"On a farm" and "At a farm" mean the same thing. Except "On a farm" would be more specific.
"In a farm" means you are physically INSIDE the farm, whether It's inside the farm house or inside a building on the farm.
However, they all mean pretty much the same thing :)