Another trick is to write a small function that tries to create an unique ID (or classname) (essentially, check if the ID exists, if so, increment an appended number), then add an inline style-script that normalizes that specific div and all of it's children and finally add your div with this unique ID (or classname).
Example:
function addDiv(){
var uId = (function(){
for(var r='myUniqueId', i=1; document.getElementById(r+i); i++);
return r+i;
})()
, div = document.createElement('div')
;
document.getElementsByTagName('head')[0]
.appendChild(document.createElement('style'))
.innerHTML = '#'+uId+ '{background-color:red;}' //just as example
+ '#'+uId+ ' .test{background-color:yellow;}';
div.id=uId;
document.getElementsByTagName('body')[0]
.appendChild(div)
.innerHTML='<p class="test">foo</p> <br> bar'; //just as example
}
Working jsfiddle here