The presence of bacteria in the urine, such as with a urinary tract infection (UTI), can affect the appearance and smell of urine. When there is an infection in the urinary tract, the urine may take on a foul-smelling odor as well as appear cloudy or bloody.