Is there a way in Xcode to create a file not associated with a project?
There is no a way to do this in Xcode. It must be related to the project or workspace. It even does this if you deselect the target. 

It sounds like what you need is a text editor and not an IDE like XCode since XCode is built for OS X and iOS development primarily. You may want to try TextWrangle for free, or it's purchasable counter part BBEdit.

If your doing C/C++, Python or PHP work, you may want to try some of the other JetBrains products like AppCode, PyCharm or PHPStorm. There is also Eclipse, with it's many plugins, the heavy favorite amongst many developers.