I am importing XML into InDesign, and I get this message:
The external entity \'blahblah.dtd\' cannot be found. Continue to import anyw
Here's an XSLT that will strip the DOCTYPE declaration:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:copy-of select="."/>
    </xsl:template>
</xsl:stylesheet>
                                                                        I think zanegray gave you the main concept although I think you overcomplicate stuff. Why not just getting xml file content, remove teh dtd declaration with a regexp and then output a new XML File that will be used for input ?
//Open and retrieve original xml file content
var originalXMLFile = File (Folder.desktop+"/foo.xml" );
originalXMLFile.open('r');
var content = originalXMLFile.read();
//Looks for a DOCTYPE declaration and remove it
content = content.replace ( /\n<!DOCTYPE[^\]]+\]>/g , "" );
originalXMLFile.close();
//Creates a new file without any DTD declaration
var outputFile = new File ( Folder.desktop+"/bar.xml" );
outputFile.open('w');
outputFile.write(content);
outputFile.close();
You can then use this filtered xml for your import.
Ok, even simplier. We just have to prevent interaction and then remove any dtds attached:
function silentXMLImport(file)
{
    var doc, oldInteractionPrefs = app.scriptPreferences.userInteractionLevel;
    if ( !(file instanceof File) || !file.exists )
    {
        alert("Problem with file : "+file );
    }
    if ( app.documents.length == 0 )
    { 
        alert("Open a document first");
        return; 
    }
    //Prevent interaction and warnings
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
    doc = app.activeDocument;
    doc.importXML ( file );
    //Remove any dtd attached to the document
    doc.dtds.everyItem().remove();
    app.scriptPreferences.userInteractionLevel = oldInteractionPrefs;
}
//Now import xml
silentXMLImport ( File ( Folder.desktop+"/foobar.xml" ) );
It's working here.