Why is 你去了北京吗 less common than 你去北京了吗?
Both 你去了北京吗 and 你去北京了吗 are possible in practice, but they are used in different situations. 

你去了北京吗 is used when you try to confirm the fact that someone really went to Beijing. Let's say you have two friends, Friend A and B. A told you that B has gone to Beijing last week. However, this information surprised you because you didn't expect B would go to Beijing for some reason. So, you might check with B with the question 你去了北京吗. The purpose is to confirm what A had said. 

你去北京了吗 is used when you know someone has a plan to go to Beijing, but you don't know whether he has already been to or not. So you might ask him 你去北京了吗 to check if he has already been to Beijing.