As you're probably guessing, the question is designed to test your staying power - how likely are you to remain with a given employer, versus jumping ship at any other opportunity?
At face value, if you're trying to get hired, it may seem like a good idea to act like you'd be dismissive of any other opportunities. "I'd tell them no, no matter what, and keep working for you forever!" Interviewers will be dismissive of that answer, it just doesn't come across as honest. On the other hand, you definitely don't want to tell them that you'd jump ship the first time someone waved money in your face!
All that said, this is a great question to get in an interview, because it gives you an opportunity to talk about what's important to you as an employee. Rather than just directly answering the question, talk about what factors would influence your decision:
Well, I do consider myself a loyal employee. The type of employer that would earn my loyalty, and put me in a position where I would not be interested in any other offers, would be an employer who...
...and from there, you can proceed by describing the factors you consider important - whether it's challenging assignments, a collaborative team, a certain level of structure, advancement opportunities, etc.
Ideally, if you've done your research as a candidate, the company you're interviewing with (the one who posed this question) would be a company that possesses these traits, so this question will help reaffirm for them that you're an ideal candidate - if they hear your answer and think, "wow, Preeyah is describing our company!" then obviously that will reflect highly on you. However, if they think, "we can't offer those things" then you may not get an offer from them, which - based on the scenario - is probably a good thing, since you're dodging an environment that doesn't have what you're looking for.