There are many examples of a country’s armed forces being and attacked or killed being used as a cause for war, but during the Korean War multiple countries deployed upwards of several thousand military service members for several years but never actually declared war on one another. I guess my main question is how could the Korean War involve the armed forces of multiple countries on both sides but only have the two Koreas in an actual state of war with one another, and never evolve into a larger conflict?
Answer for China: The Chinese troops involved were officially declared as volunteers by Mao. In reality, they were regular trained PLA infantry with uniforms that were distinct from North Korean uniforms. Chinese and Soviet pilots flew planes that bore North Korean designations. Thus the Chinese and Soviet leadership could uphold the fiction that these soldiers were acting on their own with no direct orders from Moscow and Beijing, and therefore no diplomatic ramifications for China and the USSR. The leadership of the involved nations in the UN forces of course saw through this, which is why Douglas McArthur advised to invade and even nuke Chinese territory. Had China officially entered the war, McArthur as UN high conmand in Korea would have been at more liberty to just order such attacks (nuclear weapons were not willy nilly of course, but he more or less had free rein concerning air raids, incursions and artillery strikes). Since China was not officially part of the war, McArthur's power was limited to the Korean peninsula and he had to plead for an extension to Chinese territory, which was denied.
Answer for UN troops: The troops deployed to Korea in aid of South Korea came as a UN mission to which several countries contributed, with the USA contributing both the lions share in personnel and also the high command (McArthur and Ridgway). None of the countries sent their troops on their own behalf. Who sent troops and how many was subject to both capability and political calculation. The UK, France and the Netherlands as colonial powers contributed a lot to assert their relevance as international powers, former colonies like India and the Philippines used the opportunity to emphasize their status as independent nations. Overall, the national leaders involved wanted to demonstrate that the UN, unlike the League of Nations, was a functional institution. None of the countries directly declared war on North Korea. Therefore, officially, their soldiers were not there to fight a war against North Korea (which, technically speaking, they did of course), but to enforce the UN resolution that NK cease all hostilities against SK and retrwat its troops to north of the 38th parallel.