I understand.
Since the draw function depend on the width of the displayed element (in your case a hidden div), it does not allocate a width for the table. when a table is visible it automatically inherit the width of its containing div.
In order to allocate the correct width and hide the table, just switch between the two steps. first draw the table and only then hide it. This will ensure that the table will receive the maximal width (100%) and be hidden.
table.draw(data, {showRowNumber: true});
document.getElementById('table_div').style.display='none';