I am taking a flight to Seoul but transiting through Beijing, do I need a transit visa?
Nice choice Seoul I mean enjoy it especially Hongdae, the answer is no you do not need a transit visa is you do not leave Beijing airport, as with many international airports Beijing international airport is built in such a way you can move between the gates without actually getting stamped into China.
There is also a 2nd choice if you are not American, and this is a visa on arrival if you meet the following conditions, there is a huge desk just before immigration in Beijing that issues visas and charges quite a bit of money for them too:
(2) Being invited to China to enter a bid or to formally sign an economic or trade contract;
(3) Coming to China under contract for supervision over export shipment, import commodity inspection or checked on the completion of a contract;
(4) Being invited to install equipment or make rush repairs;
(5) Coming to China at the request of the Chinese side for settling claims;
(6) Being invited to China for scientific or technological consulting services;
(7) A last-minute replacement or addition, approved by the Chinese side, to a delegation or group that has been invited and has already obtained visas for traveling to China;
(8) For visiting a patient in a critical condition or making funeral arrangements;
(9) As persons in immediate transit who, because of force majeure, are unable to leave China by original aircraft within 24 hours or have to leave China by other means of transport;
(10) As other invitees who really do not have enough time to apply for visas to the above-mentioned Chinese agencies abroad but hold letters or telegrams from designated competent authorities approving the application for visas at port visa agencies.
Note this is not open to American citizens as of 2004 as China took tit for tat against the USA for taking the finger prints of Chinese citizens and jacked up the price for Americans too. This isn't just a Chinese thing either the Russians say British people can only get visas in London with one Anomaly being Hong Kong.
So the answer is no.