The most recent instance I am aware of was at the 2007 Canadian Grand Prix, when Massa and Fisichella were black flagged for leaving the pits while the red light was up. They no longer physically wave the flag at them these days; instead, they receive a radio transmission informing them that they have been disqualified.
There has been talk in the past about introducing a black-flagged race, but it never came to be.
I believe that there have been other instances over the years, such as during World War II when rubber from black-listed countries was not allowed to be used in F1 racing cars. The only way to comply with this rule change was by using replacement parts made from different materials. This caused several problems with the design of certain vehicles in the field, especially those made by Ferrari, which relied on tire pressure to control suspension geometry and handling characteristics. If a driver changed tires during a race, he might find himself unable to control his car properly because of the change in stiffness caused by the different compound of rubber used by each team. For example, if one driver used white tires and another used black ones, the race could end up being decided by chance!
In short, there have been times when drivers have been black-flagged but still raced anyway.
The current state of affairs within Formula One was inevitable given the huge amount of money involved.
Is there ever a black flag in a Formula One race? Yes, several times. I recall de Angelis in the United Kingdom in 1981 and Australia in 1985, Prost in Italy in 1986, Senna in Brazil in 1988, Mansell in Portugal in 1989, and Schumacher in the United Kingdom in 1994.
Each time that happened, the offending car was disqualified from the race and given a drive-through penalty. The only exception was when Mansell was black-flagged for causing a crash during the Portuguese Grand Prix, but he was not disqualified at the time and so was able to finish second behind Schumacher.
There have been other incidents over the years where drivers have been black-flagged, such as Alain Prost being ordered off the track during the Japanese Grand Prix due to him having breached fuel flow regulations. But none of those instances resulted in a disqualification.
Overall, this is one of Formula One's many obscure rules. It used to be common practice for races to have some form of black flag to indicate a failed car. But since the advent of the hybrid engine formula, races no longer need to be stopped to allow for replacement engines. Therefore, all disqualified cars are given a drive-through penalty instead.
The black flag, which indicates "come into the pits now, your race is over," is the one no driver likes to see. Disqualification. It doesn't happen frequently in Formula 1 with such skilled drivers and very competent pitwall teams, but it does happen. A few years ago, there was a case where a driver was disqualified after two laps for an illegal fuel flow rate. The problem was discovered by the stewards during post-race checks and the driver had to start from the back of the grid.
The fuel flow meter used by Formula 1 works by measuring the amount of air flowing over a set of tubes at different temperatures. If any part of these tubes becomes blocked, or if there is some other error, then more or less air will pass over them than expected, which will cause the sensor to give an incorrect reading. This can lead to a lot of problems if the driver goes on using the same fuel flow rate as before, despite the fact that they are running out of gas. They might be able to drive for a while without any issues, but eventually their engine will run out of fuel and stop working!
In this case, the team will usually go into the garage immediately after the race has finished and check whether any parts of the fuel system are damaged. If not, then the driver will be allowed to continue with their bad luck on the next race weekend.