If your application is not running inside of ArcMap then you can't have an IMxDocument reference or an IApplication reference. IMxDocument refers to an ArcMap document and IApplication refers to the ArcMap application itself. If you're not inside of ArcMap then neither of those things exist in your application.