Space is so vast that astronomers can't watch all of it all of the time. So, it's possible that we would have very little warning. Depending on it's trajectory, a comet might be noticed because of the illumination of it's coma and tail. However, an asteroid, like the one that snuck up on Earth last March, can be less than a week away without catching anyone's attention.
The question is: Would we be told if collision was imminent? The Governmental stance on contact with extra-terrestrials was that we couldn't take the truth, and panic & chaos would ensue if contact were to be made.