Besides the political and strategic solutions, that were detailed in an other answer and are not operationnal solutions nor solutions under Mac Arthur's control, here are some possibilities:
- Better intelligence and better assessment of intelligence: Proper intelligence allows to prepare for the PVA's attack, but it was hard to get: Chinese airspace could not be entered by UNO's aircraft, and I suppose there was not that much American spies in China at this period. Even more, having proper inteligence on ennemy's actions does not mean you have the means to defeat them. So I suppose intelligence could help, but is not an operationnal, fast of use and standalone solution.
Let's check for others:
- Organisation of troops: After the landing of Incheon, American forces launch a pursuit that was similar to what they achieve in Northwestern Europe in 1944-1945 (sometimes). This includes fast moving motorized columns, heavy air support and even an airborne assault that was supposed to speed up the offensive and capture North Koreans soldiers. But at the end, on the Yalu, UNO forces were quite disorganized: not that units disbanded, but they were marching on a ground they did not know, they have not enough maps nor time to recognize the roads, and they were exhausted
- Logistics: the Americans faced logistics problems when they were attacked by Chinese forces. It was not really about sending supplies to the troops (even if they met some problems with the winter and unprepared equipment and clothes), but it was about sending them on roads where they were ambushed. The UN had not enough infantry to secure all the ground, thus PVA's soldiers, using night to penetrate the lines, were able to go to the rears and attack logistics
- Besides land logistics, there was a true logistic problem for air power: The offensive was so fast that not enough attack airplanes got airstrips with enough supplies from which to operate over the Yalu. Since PV had no air power and a lot of infantry, this lack of air power was a problem because it could have performed bombing and gunning on infantrymen.
The air logistic and the organisation could have been solved, and thus UNO forces could have been strengthened, by slowing the offensive so that the logistics could follow-up. But this might not have been enough, since the problem of land logistics is still there. And it is linked to a wider issue: lack of proper doctrine.
During the Yalu offensive, UNO's forces failed to adopt proper tacticals guidelines. They were acting as motorized troops in fluid battle, but with not enough men, and facing an opponent who was not tide to the roads, it resulted in two things:
- Moving colums were ambushed, logistics as fighting columns
- Other parts of the armies, who were not supposed to fight on the move (artillery, infantry) were threatened to be cut off their rears and encircled in villages or crossroads
A a result of this two elements, UNO forces started a massive retreat, and could not establish proper defensive lines. A lot of soldiers evacuated by sea.
A solution could have been to hold the ground, everywhere, all the time: Chinese infantrymen, tough mobile and brave, had not enough infantry heavy weapons to capture an Allied defense position. It was like the Japanese in Guadalcanal, or the Russians in front of Moscow in 1942: they could go to the rears of the ennemy with infantry or cavalry, they could force the ennemy to a defensive stance. But as soon as they attacked the position, they were defeated by heavier firepower and better training.
In Guadalcanal, this resulted in Americans standing for months until the logistic line of their ennemies was destroyed. But this was a sea line, so Moscow's example is more interesting: the Russian offensive started well, but as soon as the central part of the front stop retreating and entrenched itself, all Russian attacks failed. And the forces they had send fa in the rear (Belov airborne and cavalry troops for example) could move freely, but attack nothing, and they were finally destroyed by reinforcing troops.
In North Korea, this could have been done: maybe not exactly on the Yalu, but a few kilometers behind: the UNO troops showed themselves able to hold a ground (such as the Turkish corps) on a local fight, even if outnumbered. They could have created little "forts" in which waiting for attacks, with air supply and some big fighting columns occasionnally reaching them with supplies. Chinese PVA could have been blooded in those attacks, until more South Korean and American troops went to the battlefield to re-open the lines.
But the UNO troops were not ready for that: they were ordered, trained and used to fight a mobile war. So this would have required to anticipate the new situation and at least some training to the new tactics.
In real life, UNO did integrate those new tactics, but with a new commander and after having been pushed back to the South of Seoul. With those tactics, ansd their offensive twins, they were able to take back Seoul and hold the 38th parallel for 2 years.
EDIT: Adding elements after first comments of @Argyll
About the choice of the 38th parallel, the Yalu line or the Anju-Hammung line:
The insights I gave above are more about tactics and logistics, which means they are time and space-dependent. However, I have not enough knowledge to give a precise idea of when and where UNO's forces could have blocked Chinese advance, provided they had adopted those measures.
Still, we can think about it:
- In real world, the Yalu line was easily forced by Chinese forces: too far ahead, this line was reached only a few days before counterattack, so there was no time to organize proper defense. In the Moscow example I gave, Germans did have to fall back before standing on a new line. So Yalu is a no-go, according to me.
- In real world, after the retreat, UNO's forces lost Seul but were able to take it back and stabilize South of the South parallel. Then they only took little ground until reaching 38th parallel approximately. With appropriate measures, the standing line I describe could certainly have been hold farther north. Indeed, it even needed to be held as soon as possible since more retreat (which implies more coordination problems since Chinese are following the retreat) levels down the chance to hold strong points.
For example, when US Marines were forced to evacuate by the port of Hungnam on December 15th, they leveled down the chance to establish a defense on the 38th parallel.
About the defensive depths:
I don't think a strategic-deep defense was needed, since Chinese attacked line by line the defense. However, each line should have been constructed as a series of tactical deep strong points, with forward posts, entrenched cities and artillery bases. Similar to wat was found on the Bulge in 1944.