But now I'm confused about the genders involved. Why didn't you write "Je ta černá věc?"? In other words, shouldn't the subject and the object have the same gender for být?
You can't say "Je ta černá věc?". It's just gramatically wrong. You can say either "Je ta věc černá" - this way you ask if a color of the thing is really black. Or "Je to ta černá věc?/To je ta černá věc.? - this way you ask if "IT" is really the black thing.
Let's say that THING= car. "Je to auto černé?" - Is that car black? Je to to černé auto?/To je to černé auto? - Is that the black car?
1. Czech uses "to" exclusively for the indefinite "it/that". It does NOT try to match the indefinite "it/that" to the gender/number of the following noun.
2. However, when a demonstrative adjective directly precedes a noun (as in the exercise we are given here), then it DOES decline (ten/ta/kto, etc).
3. When you see the demonstrative adjective directly in front of the noun, as here, it MUST be, for example, "that thing" (just as in English). You CANNOT separate the two words.