I'm looking for same "merge" functionality (It's keeping all visible parts and discards overlaping (creates necessary nodes on shapes)) as in Illustrator in other (free) software / tool / scripts. I would like to use it for bulk of 10k files so if there is command-line options it will be best.
Object -> Group in Inksacpe has been mentioned but an alternative worth knowing about is Path-> Combine -it has a caveat that that you only work with paths - so not gradients, clones etc. It's also extremely useful for getting round Inkscape's 2 object limit for most of its path tools, filters and extensions.
Why you would use either depends on what you want to gather together and why.
Object -> Group will make a composite object without altering ordering, fill colour, stroke weight or individual effects. You can also use the Object Properties browser to selectively hide elements and Selection Sets to make accessing individual elements within a group much easier.
For the example you posted, using grouping, the end result will be an object that looks like your final image.
Path -> Combine will allow Inkscape to treat various paths them as 1 path object with the colour and stroke weight being set to that of the topmost path object. It will allow you to use a single path subtraction to cut the hexagon into all 3 shapes.
If you are dealing with a lot of objects and you want them to keep their individual fill, stoke and so on, then groups are the way to go. If the negative space of a shape interacting with other shapes is what you want then use the pathing tools. Though you will have to repeat the intersection with each object if you want them to retain their fill colour etc.
For dealing with the 10k files, and double guessing what you want to do with them, you can run Inkscape from the command line and assuming your dealing with SVG, Inkscape will turn the import into a group maintaining the original positioning, z order and so on of the original file.
So start by making a document that will be the container for all your files
-> create a new document
then again from the command line
-> FileOpen /the/file/you/just/made -> FileImport -> FileSave
if you put a programming loop around this (in whatever language you prefer - java, python, perl, ruby) that counts up to 10k or however many files you have, it will store them in the same document.
If they are .ai files, as I recall Inkscape will correctly handle anything that is standard SVG, however if you have used Illustrator internals like symbols and gradient meshes, you'll need to change these to something non propriatry before hand - export them as svg from Illustrator first.
More info on the commands available for Inkscape