In אלוקי נשמה, we thank ה׳ for giving us our souls, and we say that He is destined to take them from us.
According to the Gemara in Shabbat 152b and the Zohar Vol.II 108b, those who are alive at the time of Techiyat Hamesim will have to die and return to dust one hour before the resurrection in order to fulfill the verse that says, 'and to the dust shall you return". Therefore this is not a contradiction. Everyone will die even if only for a moment.
One approach: He is destined to take it from us when we go to sleep (sleep is 1/60th of death - Talmud Bavli Berachot 57b - due to the fact that our soul is taken from us, at least in a small part), and then to return it to us when we wake up (when we will say in modeh ani: שהחזרת בי נשמתי - Thanks - that you have returned into me my soul).
Another approach, if you want to relate this to death and resurrection of the dead, is that God will take out souls from our bodies when we die, and then return it when we are resurrected. There is a dispute among Rishonim as to what exactly תחית המתים (Resurrection of the dead) means (Rambam and Ramban have different understandings), and what it will mean for those who are living at the time. So then maybe read it as "if we die before the Resurrection, then out souls will be returned to us when the Resurrection arrives). I don't think that it is trying to state a hope that there will not be a Resurrection (which according to Rambam is one of the 13 principles of faith).
I think we are emphasizing the fact that the soul is only on loan from G-d, since G-d gives it to us intending to take it back. And therefore, as the Brachah continues, as long as the soul is within me I praise G-d.
Its not so clear that mashiach will bring Techiyas HaMesim. According to the Amora Shemuel, (and the Rambam), Yemos haMashiach will be similar to today, and people will live normal lives and die. Techiyas haMesim will be at a further point in the future, so it doesn't seem like people in pre-messianic times will live to it.
(In addition, according to the Rambam, even techiyas hemesim wont be forever, and everyone will eventually leave their bodies.)
I feel like I'm repeating what others are saying, but I wanted to chime in with my own version of the combined statements. I think the author(s) of the Berachah pretty clearly intended that there WILL BE a resurrection. But I don't think that's the question being asked. I think, though, that the intent is as Menachem suggested, which is that "as long as the soul is within me (that is to say, every waking moment) I praise G-d". Nothing more, nothing less.