I think both DarklordoftheSUSY and hermitcrab47 have good advice and their experiences are important to learn from.
As DarklordoftheSUSY's experience shows, if you cannot show how your interest fits into the department, it will be very unlikely to get you in.
But as hermitcrab47 rightly points out, no one expects you to do the same research in undergrad as grad school. To be honest, undergrad research is pretty shallow and you're not going to be an expert in your subfield even if you do your thesis on it. So, it's not like if you did an undergrad thesis in X that you would have an advantage over other students who is starting grad school for the first time in X.
Undergrad research is the time to learn basic research skills that you can apply to all types of projects in all fields. It's also the time to experiment and try things that interest you.
So, ultimately, my advice to you is that if you are interested in string theory (or if that's your best opportunity right now) then take it and run with it. When you apply to grad school, you can just make sure to explain to them what you really want to work on and if that's not string theory, it's no problem. Also, if you are a junior or younger, you probably can have research experience in other fields before you start.
In undergrad, I worked 8 months on a cosmology project. Then 8 months in medical physics. Then a senior thesis on asteroids. My masters was in planet formation and my PhD thesis is on extrasolar planets. None of the grad schools I applied to expected me to be wanting to work on the same stuff I did before and in fact, some of them mentioned to me that they were especially interested in my application because of the diverse skillset I picked up from multiple research projects.