I managed to solve the issue. Here is my solution:
ESRI.ArcGIS.ArcMapUI.IMxDocument mxDoc = null;
ESRI.ArcGIS.Framework.IApplication app = null;
//get instance of the running AppRot
ESRI.ArcGIS.Framework.IAppROT appRot = new ESRI.ArcGIS.Framework.AppROTClass();
//Loop through running application
for (int i = 0; i < appRot.Count; i++)
{
app = (ESRI.ArcGIS.Framework.IApplication)appRot.get_Item(i);
mxDoc = app.Document as ESRI.ArcGIS.ArcMapUI.IMxDocument;
//find correct instance by job name in application caption
if (mxDoc != null && app.Caption.ToLower().Contains("job_" + JobID))
{
i = appRot.Count;
}
else
{
app = null;
mxDoc = null;
}
}