It depends on the license, and also somewhat on the country.
For the BSD and MIT licenses, this is a friendly yes. Your "derivative work" contains a separate copyright interest from the original and those licenses did not place any requirements on your copyright interest. These are called non-copyleft licenses. They basically say "to use this software, you must promise not to sue us. In return we promise that we will not sue you."
For the GPL license, this is an emphatic no. It is part of that license to use the software that any derivative work which incorporates and/or extends the software must be licensed to anyone that it is conveyed to under the GPL, and you must provide source code. This is quite by design, and is more complex to think about; basically: "To use this software you must promise not to sue us. We promise that we will not sue you except in one case: if you start giving modified versions of this software to other people while keeping the source code to yourself and/or retaining the threat to sue them, we reserve the right to sue you."
So the first case is kind of a "we're going to reduce lawsuits by both putting our hands where we each can see them," passively, while copyleft licenses attempt to use threats of lawsuits to discourage further lawsuits, actively.
Some things, like Qt, use the LGPL, which allows you to include that code alongside other proprietary code without open-sourcing the lot of them: however you must still release any modifications you make to the LGPL code and you must have some sort of firm barrier between the LGPL and proprietary parts (different source files leading to different object files) so that the two aren't confused.