WASHINGTON — The surprise defeat of the farm bill in the House on Thursday underscored the ideological divide between the more conservative, antispending Republican lawmakers and their leadership, who failed to garner sufficient votes from their caucus as well as from Democrats.