You should book rooms in advance (China is different from India in that sense). There are numerous sites that are good for that - pagoda, hostelword, hostelbookers etc. You can also book by phone or email and save the site commission.
It's highly recommended to book a room in advance. A super recommended place is the King Joy Hotel. It has dorms, an amazing hotel! Leo Hostel, and Three Legged Frog are also recommended. All of those hostels are in Qianman area, Beijing.