Some strains are invasive, so the immune system does encounter them and starts an inflammation reaction. If the strain is non-invase, you don't get an inflammation reaction. You then still get sick because of the toxins produced by the bacteria. I'm not sure how the body fights such an infection (it could sense the toxins and set up a response).
Some different E.coli strains and their characteristics:
ETEC
fimbrial adhesins e.g. CFA I, CFAII, K88. K99
non invasive
produce LT and/or ST toxin
watery diarrhea in infants and travelers; no inflammation, no fever
EIEC
nonfimbrial adhesins, possibly outer membrane protein
invasive (penetrate and multiply within epithelial cells)
does not produce shiga toxin
dysentery-like diarrhea (mucous, blood), severe inflammation, fever
EPEC
non fimbrial adhesin (intimin)
moderately invasive (not as invasive as Shigella or EIEC)
does not produce LT or ST; some reports of shiga-like toxin
usually infantile diarrhea; watery diarrhea similar to ETEC, some inflammation, no fever; symptoms probably result mainly from invasion rather than toxigenesis
EAggEC
adhesins not characterized
non invasive
produce ST-like toxin (EAST) and a hemolysin
persistent diarrhea in young children without inflammation, no fever
EHEC
adhesins not characterized, probably fimbriae
moderately invasive
does not produce LT or ST but does produce shiga toxin
pediatric diarrhea, copious bloody discharge (hemorrhagic colitis), intense inflammatory response, may be complicated by hemolytic uremia.
from
http://textbookofbacteriology.net/e.coli.html