Let's say a pitcher is currently pitching a no-hitter: No runs, no hits, 9 innings pitch. However, his offense gets no runs and he gives up one unearned run by having a dropped ball in the outfield, and a run scores even though he gave up no earned hits or no base on balls. The pitcher's team loses the game 1-0 and that pitcher's stat line is 9IP, 0ER, 1R, 0H, 0BB. Does he still get credited with a loss?
Yes. He was the pitcher of record at the time that the other team took the lead and never relinquished it, so he gets the loss.
While this may seem unlikely, most things have happened in baseball at one time or another; depending slightly on your definition of "no hitter" there have been five instances of this since 1900 - three of those were for the away team, so the pitcher pitched only eight innings, making it not an official no hitter.