In theory you can't patent something that has already been described prior to the filing date. In practice I'm sure there's been things that've been patented that someone else independently invented beforehand. It's also not always clear if something is a new invention or not (e.g., some chemical has been known for a while but someone realized it could be used to treat some disease).