If we could only write what we know there would be no Harry Potter, no One Hundred Years of Solitude, no Red Badge of Courage. So many great novels would have never been written because the writer tried to stay on the narrow road of his own experience. Don't write what you know. Write what you can imagine. OK, you can write what you know--sure. BUT you don't have to.
I do think this advice has some truth in it. You have to be emotionally engaged in what you write and you have to find experiences in your own life that will help you be emotionally engaged. These experiences might come from actual life but they can also come from things you've read or watched in a movies or over-heard at a party. Whatever you use, it is only raw material. For me, at some point, imagination will transform these kernels of experience into something very different, something that fits in the story.
Write what you know is, for some of us, like wearing a straight-jacket. We might as well be coloring by number. Our characters and our worlds won't breathe. There will be no life. Write what you want: What you know, what you can imagine, what you over-hear, read, see, whatever gets your work done.
Or so I think today.