Officially, having a US visa allows you to exit Incheon airport during a transit, but only when you are traveling to or from the US.
Anecdotally, I have heard that Korean immigration officials have allowed transiting passengers with a US visa to leave the airport even if they are not traveling to or from the US. I would not count on this, though, as it is ...
You don’t need a visa if you transit within 24 hours and you hold valid documents for your next destination.
Per TIMATIC, the database used by airlines:
TWOV (Transit Without Visa):
Visa required, except for Passengers transiting through Seoul
(ICN) with a confirmed onward ticket for a flight to a third
country within 24 hours. They must stay in ...
You will need some form of onward ticket. Korean immigration doesn't even enter into it: Without the ticket the airline will not even let you board the flight to Korea.
The Airline will check the TIMATIC system mentioned in the other answer, and make sure you have all the necessary documentation. The reason is that if the don't and you fail to get through ...
I did china visa in seoul.
with a business class full flex ticket to Seoul with return date set after 4 months I was just rejected from checking in at dusseldorf airport because I can only stay 3 months without visa.