The truth is that science fiction need not have any of those things in it, and just because a book, film, or television show contains them it doesn't necessarily mean it's best placed in the science fiction genre.
Star Wars is possibly the best known and most divisive example of that; it's mostly fantasy, but with many science fiction elements which — funnily enough — all fall squarely into the robots, spaceships, and aliens category. The story itself combines two fantasy tropes: "The Hero's Journey" and "The War Between Good and Evil". Everything else is window dressing, and the actual story would probably suffer no ill effects if it were set in Middle Earth instead of a galaxy far, far away.
So how do we tell if something is science fiction, and what use is it anyway?