Today, with sites such as wikipedia.org and Google, you're no longer restricted to simply write what you know. If you don't know it, research it and find out.
Case in point: When I wrote my first draft of The Fourth Portal, I needed one of my characters to explain how a microscope works. Set a few hundred years into the future, Character A was an engineer used to computer scanners that provided a three-dimensional, interactive representation with the capability to enlarge images too small to see with the naked eye. Character B, on the other hand, was a technology collector, collecting instruments dating back to the early 20th century. One of these included a microscope. Having never before seen a microscope, Character A had to be told how a microscope worked.
So where to start?
My first stop was Google. By simply typing the phrase How does a microscope work, I found numerous pages explaining in very technical terms how a microscope functions. One link took me to this page. A very interesting read, this article gives a basic explanation with references to other reference works.
My next stop was Wikipedia. Some doubt the accuracy of Wikipedia. Personally I have found that most information is accurate, especially articles written and updated by industry professionals. I did a search for microscope, which resulted in a concise, yet technically loaded, article about the history of the microscope, different types and how they work.
With all this information literally at my fingertips, Character B could convincingly explain to Character A what a microscope was, how it works, and how it will help them out of their current predicament.
Twenty years ago, I would have had to choose one of two options:
1. Change the microscope to something else I was familiar with that would help their situation.
2. Go down to the library and spend hours reading through numerous books to find all the information I needed.
Some would argue that option 2 isn't really such a bad idea. By no means am I suggesting that the library has outlived its usefulness. To this day many writers do much of their research in libraries. In a society of convenience, going to the library might just simply be 'inconvenient'. Twenty years ago, I simply would not have had the option to spend hours in the library doing my research.
So what does that mean in relation to the advice I was given to write what I know? The same rule applies still today. Don't write about something you don't know about. The worst mistake a writer can make is get the facts wrong. You will loose credibility not only with your agent/publisher, but also your readers. Once you've lost your credibility, it's a steep road to get it back again.
Write what you know. If you're not sure about it, research it. Find out. Search the internet, go to your local library and research the subject. Then you can write about what you know.