When a thief comes into your house. He comes unaware to you. It could be that your door wasnt properly locked or it could that you locked up well. In the end, if he will be able to enter into your home is determined by that factor.
I think God made that statement to tell us to always be ready for his coming. Its simple, He is saying i can come when you sin and have not asked for forgiveness. I can come that moment you fall for the devils temptation. Do you remember how unexpected test in school comes?... when you have barely read that course?... thats how He will come.
All we have to do is keep studying and make sure we understand the course before every class.... every minute. He may come before you blink an eye. Be prepared at all times...