Lets look at some of the basic setups here:
Sea Dwellers and Land Dwellers
Chances are, the sea dwellers will spread out on the coast.
Surface dwellers like coastal land, because it is some of the best land.
So they will be in close contact. They will have some overlap of interests (which can be a source of competition or cooperation).
Sea Dwellers and Underground Dwellers
Underground dwellers won't really have any major relations with sea-dwellers. They can't dig too close to the sea anyway and there is little overlap in interest.
Land Dwellers and Underground Dwellers
Land dwellers can probably make tunnels (even if there isn't much food for them down there), and underground dwellers can probably live on the surface (even if there isn't much food for them up there). Indeed, to some extent it is probably necessary for either of these races to do just tthat if they were alone (for example humans often need tunnels to mine). But underground dwellers are a lot better at tunnels than land-dwellers are, and land-dwellers are a lot better at completing tasks on the surface. So, there is a possibility for them to help each other out a fair amount. However, note that surface dwellers rarely need to mine deeply, and underground dwellers probably rarely need to complete any task on the surface. So while they can definitely help each other, they also definitely don't need each other.
Beyond this point... Assuming all of these races are a bit like humans... It's pretty much all up to politics.
I could envision coastal city-states rising up that include sea-dwellers and coastal surface-dwellers under one banner, fishing, farming, and trading well. I suspect that such a society would be uncommonly prosperous, and it's a lot harder to hold deep resentments when everything is going well. This means that the two species, at least in the locality of such a city-state, would be coexisting successfully.
I could also envision a large land-dwelling nation with some of their boarder on the coast being seriously annoyed that this stretch is largely claimed by sea-dwellers, and building warships and harpoons so that they can use their coast normally. In this case the warships would probably get sunk and the large centralized land nation would keep being annoyed. Full scale conflict would be difficult, because either A) they don't have sufficient technology to stand a chance in the enemy's home turf or B) they have enough technology that they reach the mutually assured destruction problem, and full scale conflict is still impossible.
It is possible that underground-dwellers trade minerals and similar raw materials for crops and wood on the surface. This could happen on the fringes of a large land-nation, or they could be members of the large nation who tend to specialize in things like mining, or they could be completely foreign but occasionally trading (the last one assumes that these underground dwellers more or less don't need any food from the surface, which you hinted is true).
It is also possible that the underground dwellers keep their distance from the land dwellers, and any land dweller who goes into their cave doesn't come out because they don't like visitors. In this case I really don't see full war being common though. Too inconvenient. Unless some event happened that really, really enraged on or both groups, they would pretty much just trade or keep their distance.
In summary there are two basic types of relationships species like this are likely to exhibit. Other types of relationship are possible, but they are probably unlikely without some kind of major catalyzing event.
1) A single nation comprised of both of the two species, where both of them belong in society, and the society enjoys some measure of prosperity because members of society are biologically more able to specialize. In such a society, racial tensions are still a very real possibility, but open war between species is impossible because they are all part of one nation (I suppose a civil war can't be ruled out, however, this would only be remotely possible if the two species occupied different geographical areas within the single nation. For a civil war to break out, the opposing sides can't be evenly distributed across the entire nation; there needs to be localities that all support one of the two sides. In my city-state example, civil war is quite unlikely because everyone lives in one city or the surrounding area. I don't recall any time in history where a city state underwent civil war. City-states are prone to competition with each other, but they are too small to sustain an internal, sectionalized conflict.)
2) Two separate nations, one of each species, that remain mostly aloof. Sporadic trade deals and border skirmishes will happen, but neither trade nor border skirmishes are terribly useful to either side so they mostly keep to themselves and expect the other nation to do the same. This option isn't very exciting, but it is a very real possibility.
Chances are, in an entire planet there are some nations or pairs of nations that exhibit the first behavior, and some that exhibit the second. At a given point in time, both possibilities are expressed somewhere.