Secretaries of State generally register names on a first come, first served basis, so if you came in second, too bad. A company that had already registered a name has no obligation to turn over their name, and chances are they may not want to if they've already invested time and money into building their brand and name recognition.
That said, you may be able to register a name that's similar -- for example, "Janes Desserts" instead of "Janes Cookies" -- so you may be better off trying to come up with a new name and avoiding the complications of getting the other company to part with something that's dear to them.
Nina L. Kaufman, Esq. is an award-winning New York City attorney, edutainer and author. Under her Ask The Business Lawyer brand, she reaches thousands of entrepreneurs and small business owners with her legal services, professional speaking, information products, and LexAppeal weekly ezine. She also writes the Making It Legal blog.