As you traverse the model you need to check two things, the visibility property of the drawingelement and the visibility of the layer it is on.
SUDrawingElementGetHidden
http://extensions.sketchup.com/developer_center/sketchup_c_api/sketchup/drawing__element_8h.html#a79d3a91422578b3de68291d52a659055
SULayerGetVisibility
Page Not Found | SketchUp Extension Warehouse
Note that both of these properties are local to that entity/layer - they don’t keep track of the visibility of the parent containers.