I wonder why D3.js doesn't add the namespace attributes to the SVG element.
d3.ns.prefix.ex = 'http://example.com/';
var chart = d3.select('#chart').append('svg:svg');
I think the output should something like:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ex="http://example.com/">
Actually its just
<svg>
See this fiddle for a complete example: http://jsfiddle.net/7kWDK/