To be precise, you'll need to consult a repair manual specific to your truck's year. A Haynes or Chilton manual, or a digital version from a site like Mitchell1, will show you a diagram and give you the exact location. Searching online for "[Your Year] Ford F-150 4.9L Knock Sensor Location" with the year of your truck will also likely yield helpful images and information from forums.
Without the year, it's impossible to give you a definitive answer.