Can it be undetectable at this time?

I went to the e.r. and they said I have a uti and a yeast infection and it was 8 days before my period. They said I wasn't pregnant but with all that bacteria and it being 8 days before my period can it be really hard to tell if I actually am pregnant?